Expanding TestHeuristcs to include all Objective C header files

This commit is contained in:
Arfon Smith
2013-12-16 15:27:48 -08:00
parent 4adbbc3fcc
commit a49303c93f
2 changed files with 469 additions and 153 deletions

View File

@@ -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