Merge pull request #2811 from pchaigno/pod-heuristic

Heuristic for Pod vs. Perl
This commit is contained in:
Arfon Smith
2016-01-18 07:59:47 -05:00
4 changed files with 26 additions and 0 deletions

View File

@@ -293,6 +293,14 @@ module Linguist
end
end
disambiguate ".pod" do |data|
if /^=\w+$/.match(data)
Language["Pod"]
else
Language["Perl"]
end
end
disambiguate ".pro" do |data|
if /^[^#]+:-/.match(data)
Language["Prolog"]

10
samples/Perl/Sample.pod Normal file
View File

@@ -0,0 +1,10 @@
use strict;
use warnings;
package DZT::Sample;
sub return_arrayref_of_values_passed {
my $invocant = shift;
return \@_;
}
1;

View File

@@ -155,6 +155,14 @@ class TestHeuristcs < Minitest::Test
})
end
# Candidate languages = ["Pod", "Perl"]
def test_pod_by_heuristics
assert_heuristics({
"Perl" => all_fixtures("Perl", "*.pod"),
"Pod" => all_fixtures("Pod", "*.pod")
})
end
# Candidate languages = ["IDL", "Prolog", "QMake", "INI"]
def test_pro_by_heuristics
assert_heuristics({