Skip to content

Commit

Permalink
Test classifier on ambiguous languages
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jun 19, 2012
1 parent 9810c69 commit c114d71
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/test_classifier.rb
Expand Up @@ -59,10 +59,16 @@ def test_gc
Classifier.instance.gc
end

# def test_instance_classify
# Sample.each do |sample|
# results = Classifier.instance.classify(sample.data)
# assert_equal sample.language, results.first[0], sample.path
# end
# end
def test_classify_ambiguous_languages
Sample.each do |sample|
next unless sample.language.overrides.any?

extname = File.extname(sample.path)
languages = Language.all.select { |l| l.extensions.include?(extname) }
next unless languages.length > 1

results = Classifier.instance.classify(sample.data, languages)
assert_equal sample.language, results.first[0], "#{sample.path}\n#{results.inspect}"
end
end
end

0 comments on commit c114d71

Please sign in to comment.