Compare commits

...

2 Commits

Author SHA1 Message Date
Joshua Peek
cf624e44ff Linguist 2.0.1 2012-06-21 11:48:08 -05:00
Joshua Peek
2b712dc790 Guard against classify nil data 2012-06-21 11:47:32 -05:00
3 changed files with 6 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'github-linguist'
s.version = '2.0.0'
s.version = '2.0.1'
s.summary = "GitHub Language detection"
s.authors = "GitHub"

View File

@@ -97,6 +97,7 @@ module Linguist
# Returns sorted Array of result pairs. Each pair contains the
# Language and a Float score.
def classify(tokens, languages = @languages.keys)
return [] if tokens.nil?
tokens = Tokenizer.new(tokens).tokens if tokens.is_a?(String)
scores = {}

View File

@@ -55,6 +55,10 @@ class TestClassifier < Test::Unit::TestCase
assert results.first[1] < 0.5, results.first.inspect
end
def test_instance_classify_nil
assert_equal [], Classifier.instance.classify(nil)
end
def test_verify
assert Classifier.instance.verify
end