Heuristic rule for TeX .cls files (#3360)

This commit is contained in:
Paul Chaignon
2016-12-07 06:50:33 +01:00
committed by Brandon Black
parent cd30c7613c
commit 79f20e8057
2 changed files with 15 additions and 0 deletions

View File

@@ -110,6 +110,12 @@ module Linguist
end
end
disambiguate ".cls" do |data|
if /\\\w+{/.match(data)
Language["TeX"]
end
end
disambiguate ".cs" do |data|
if /![\w\s]+methodsFor: /.match(data)
Language["Smalltalk"]

View File

@@ -73,6 +73,15 @@ class TestHeuristcs < Minitest::Test
})
end
def test_cls_by_heuristics
assert_heuristics({
"TeX" => all_fixtures("TeX", "*.cls"),
nil => all_fixtures("Apex", "*.cls"),
nil => all_fixtures("OpenEdge ABL", "*.cls"),
nil => all_fixtures("Visual Basic", "*.cls"),
})
end
def test_cs_by_heuristics
assert_heuristics({
"C#" => all_fixtures("C#", "*.cs"),