Skip to content

Commit 635fd1b

Browse files
Add basic mode checks for perl (#57)
Add basic mode checks for perl Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
1 parent 8bec6e0 commit 635fd1b

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

lib/languages/perl5.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package
2+
use strict
3+
use warnings
4+
use v5
5+
use 5
6+
use feature
7+
use Exporter
8+
our @EXPORT
9+
#

test/languages/perl5_test.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require "test_helper"
2+
module SnippetExtractor
3+
module Languages
4+
class PerlTest < Minitest::Test
5+
def test_all
6+
code = <<~CODE
7+
package HelloWorld;
8+
use v5.36;
9+
use 5.036;
10+
use strict;
11+
use warnings;
12+
use feature qw<say>;
13+
use Exporter qw<import>;
14+
our @EXPORT_OK = qw<hello>;
15+
16+
# test comment
17+
sub hello {
18+
return 'Hello, World!';
19+
}
20+
CODE
21+
expected = <<~CODE
22+
sub hello {
23+
return 'Hello, World!';
24+
}
25+
CODE
26+
assert_equal expected, ExtractSnippet.(code, 'perl5')
27+
end
28+
end
29+
end
30+
end

0 commit comments

Comments
 (0)