mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Return early in Classifier.classify if no languages supplied (#3471)
* Return early if no languages supplied There's no need to tokenise the data when attempting to classify without a limited language scope as no action will be performed when it comes to scoring anyway. * Add test for empty languages array
This commit is contained in:
@@ -53,4 +53,8 @@ class TestClassifier < Minitest::Test
|
||||
assert_equal language.name, results.first[0], "#{sample[:path]}\n#{results.inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
def test_classify_empty_languages
|
||||
assert_equal [], Classifier.classify(Samples.cache, fixture("Ruby/foo.rb"), [])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user