mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Expanding TestHeuristcs to include all Objective C header files
This commit is contained in:
@@ -14,11 +14,18 @@ class TestHeuristcs < Test::Unit::TestCase
|
||||
def fixture(name)
|
||||
File.read(File.join(samples_path, name))
|
||||
end
|
||||
|
||||
# Only calling out '.h' filenames as these are the ones causing issues
|
||||
def all_h_fixtures(language_name)
|
||||
Dir.glob("#{samples_path}/#{language_name}/*.h")
|
||||
end
|
||||
|
||||
def test_find_by_heuristics
|
||||
def test_obj_c_by_heuristics
|
||||
languages = ["C++", "Objective-C"]
|
||||
results = Heuristics.find_by_heuristics(fixture("Objective-C/StyleViewController.h"), languages)
|
||||
assert_equal Language["Objective-C"], results.first
|
||||
all_h_fixtures("Objective-C").each do |fixture|
|
||||
results = Heuristics.find_by_heuristics(fixture("Objective-C/#{File.basename(fixture)}"), languages)
|
||||
assert_equal Language["Objective-C"], results.first
|
||||
end
|
||||
end
|
||||
|
||||
def test_detect_still_works_if_nothing_matches
|
||||
|
||||
Reference in New Issue
Block a user