mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #2811 from pchaigno/pod-heuristic
Heuristic for Pod vs. Perl
This commit is contained in:
@@ -293,6 +293,14 @@ module Linguist
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
disambiguate ".pod" do |data|
|
||||||
|
if /^=\w+$/.match(data)
|
||||||
|
Language["Pod"]
|
||||||
|
else
|
||||||
|
Language["Perl"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
disambiguate ".pro" do |data|
|
disambiguate ".pro" do |data|
|
||||||
if /^[^#]+:-/.match(data)
|
if /^[^#]+:-/.match(data)
|
||||||
Language["Prolog"]
|
Language["Prolog"]
|
||||||
|
|||||||
10
samples/Perl/Sample.pod
Normal file
10
samples/Perl/Sample.pod
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
package DZT::Sample;
|
||||||
|
|
||||||
|
sub return_arrayref_of_values_passed {
|
||||||
|
my $invocant = shift;
|
||||||
|
return \@_;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
@@ -155,6 +155,14 @@ class TestHeuristcs < Minitest::Test
|
|||||||
})
|
})
|
||||||
end
|
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"]
|
# Candidate languages = ["IDL", "Prolog", "QMake", "INI"]
|
||||||
def test_pro_by_heuristics
|
def test_pro_by_heuristics
|
||||||
assert_heuristics({
|
assert_heuristics({
|
||||||
|
|||||||
Reference in New Issue
Block a user