mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Fix for fixture tests: fixture files were not tested at all
This commit is contained in:
@@ -469,16 +469,16 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
# Test language detection for files which shouldn't be used as samples
|
# Test language detection for files which shouldn't be used as samples
|
||||||
root = File.expand_path('../fixtures', __FILE__)
|
root = File.expand_path('../fixtures', __FILE__)
|
||||||
Dir.entries(root).each do |language|
|
Dir.entries(root).each do |language|
|
||||||
next unless File.file?(language)
|
next if language == '.' || language == '..'
|
||||||
|
|
||||||
# Each directory contains test files of a language
|
# Each directory contains test files of a language
|
||||||
dirname = File.join(root, language)
|
dirname = File.join(root, language)
|
||||||
Dir.entries(dirname).each do |filename|
|
Dir.entries(dirname).each do |filename|
|
||||||
next unless File.file?(filename)
|
|
||||||
|
|
||||||
# By default blob search the file in the samples;
|
# By default blob search the file in the samples;
|
||||||
# thus, we need to give it the absolute path
|
# thus, we need to give it the absolute path
|
||||||
filepath = File.join(dirname, filename)
|
filepath = File.join(dirname, filename)
|
||||||
|
next unless File.file?(filepath)
|
||||||
|
|
||||||
blob = blob(filepath)
|
blob = blob(filepath)
|
||||||
assert blob.language, "No language for #{filepath}"
|
assert blob.language, "No language for #{filepath}"
|
||||||
assert_equal language, blob.language.name, blob.name
|
assert_equal language, blob.language.name, blob.name
|
||||||
|
|||||||
Reference in New Issue
Block a user