diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index d5342b77..221330b8 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -165,7 +165,7 @@ module Linguist elsif data.include?("flowop") Language["Filebench WML"] elsif fortran_rx.match(data) - Language["FORTRAN"] + Language["Fortran"] end end @@ -173,7 +173,7 @@ module Linguist if /^: /.match(data) Language["Forth"] elsif fortran_rx.match(data) - Language["FORTRAN"] + Language["Fortran"] end end @@ -226,7 +226,7 @@ module Linguist elsif /^(%[%{}]xs|<.*>)/.match(data) Language["Lex"] elsif /^\.[a-z][a-z](\s|$)/i.match(data) - Language["Groff"] + Language["Roff"] elsif /^\((de|class|rel|code|data|must)\s/.match(data) Language["PicoLisp"] end @@ -270,7 +270,7 @@ module Linguist if /(^[-a-z0-9=#!\*\[|>])|<\//i.match(data) || data.empty? Language["Markdown"] elsif /^(;;|\(define_)/.match(data) - Language["GCC machine description"] + Language["GCC Machine Description"] else Language["Markdown"] end @@ -296,7 +296,7 @@ module Linguist disambiguate ".ms" do |data| if /^[.'][a-z][a-z](\s|$)/i.match(data) - Language["Groff"] + Language["Roff"] elsif /(? all_fixtures("FORTRAN", "*.f") + all_fixtures("FORTRAN", "*.for"), + "Fortran" => all_fixtures("Fortran", "*.f") + all_fixtures("Fortran", "*.for"), "Forth" => all_fixtures("Forth", "*.f") + all_fixtures("Forth", "*.for") }) end @@ -144,6 +144,15 @@ class TestHeuristcs < Minitest::Test }) end + def test_l_by_heuristics + assert_heuristics({ + "Common Lisp" => all_fixtures("Common Lisp", "*.l"), + "Lex" => all_fixtures("Lex", "*.l"), + "Roff" => all_fixtures("Roff", "*.l"), + "PicoLisp" => all_fixtures("PicoLisp", "*.l") + }) + end + def test_ls_by_heuristics assert_heuristics({ "LiveScript" => all_fixtures("LiveScript", "*.ls"), @@ -174,17 +183,25 @@ class TestHeuristcs < Minitest::Test def test_md_by_heuristics assert_heuristics({ "Markdown" => all_fixtures("Markdown", "*.md"), - "GCC machine description" => all_fixtures("GCC machine description", "*.md") + "GCC Machine Description" => all_fixtures("GCC Machine Description", "*.md") }) end def test_ms_by_heuristics assert_heuristics({ + "Roff" => all_fixtures("Roff", "*.ms"), "Unix Assembly" => all_fixtures("Unix Assembly", "*.ms"), "MAXScript" => all_fixtures("MAXScript", "*.ms") }) end + def test_n_by_heuristics + assert_heuristics({ + "Roff" => all_fixtures("Roff", "*.n"), + "Nemerle" => all_fixtures("Nemerle", "*.n") + }) + end + # Candidate languages = ["C++", "Objective-C"] def test_obj_c_by_heuristics # Only calling out '.h' filenames as these are the ones causing issues @@ -237,6 +254,13 @@ class TestHeuristcs < Minitest::Test }) end + def test_rno_by_heuristics + assert_heuristics({ + "RUNOFF" => all_fixtures("RUNOFF", "*.rno"), + "Roff" => all_fixtures("Roff", "*.rno") + }) + end + # Candidate languages = ["Scala", "SuperCollider"] def test_sc_supercollider_scala_by_heuristics assert_heuristics({