diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 01be4e33..0806ce1f 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -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"] diff --git a/samples/Perl/Sample.pod b/samples/Perl/Sample.pod new file mode 100644 index 00000000..00fa0b99 --- /dev/null +++ b/samples/Perl/Sample.pod @@ -0,0 +1,10 @@ +use strict; +use warnings; +package DZT::Sample; + +sub return_arrayref_of_values_passed { + my $invocant = shift; + return \@_; +} + +1; diff --git a/samples/Perl/PSGI.pod b/samples/Pod/PSGI.pod similarity index 100% rename from samples/Perl/PSGI.pod rename to samples/Pod/PSGI.pod diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 524a522a..702320e9 100644 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -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({