-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from oposs/actions_tests_regex++
- Loading branch information
Showing
21 changed files
with
379 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
perl: | ||
- '5.22' | ||
- '5.26' | ||
- '5.32' | ||
|
||
fail-fast: true | ||
name: perl${{ matrix.perl }}/${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup perl | ||
uses: shogo82148/actions-setup-perl@v1 | ||
with: | ||
perl-version: ${{ matrix.perl }} | ||
|
||
- name: Configure | ||
run: perl Makefile.PL | ||
|
||
- name: Make | ||
run: make | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Dist | ||
run: make dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.2 | ||
0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../lib"; | ||
|
||
use Devel::Deanonymize qw(alterContent); | ||
|
||
sub read_file { | ||
my $path = shift; | ||
my $fh; | ||
open $fh, '<', $path or die "Can't open `$path`: $!"; | ||
my $file_content = do { | ||
local $/; | ||
<$fh> | ||
}; | ||
return $file_content; | ||
} | ||
|
||
|
||
my @files = ("Dummy0.pm", "Dummy1.pm", "Dummy2.pm", "Dummy3.pm", "Dummy4.pm", "Dummy5.pm"); | ||
my @test_titles = ( | ||
"`1;` endmarker, with evil variables ", | ||
"`1;` endmarker, with evil comment", | ||
"`__END__` endmarker, with anon sub", | ||
"`1;` endmarker, open =cut section", | ||
"`1` endmarker, no semicolon", | ||
"No endmarker" | ||
); | ||
for my $idx (0 .. $#files) { | ||
my $input = read_file("t/test_data/$files[$idx]"); | ||
my $expected = read_file("t/test_data/$files[$idx]_exp"); | ||
my $res1 = Devel::Deanonymize::alterContent($input, "wrapper_$idx"); | ||
# if ($files[$idx] eq "Dummy3.pm") { | ||
# print $res1; | ||
# } | ||
ok $res1 eq $expected, $files[$idx] .": ". $test_titles[$idx]; | ||
eval($res1); | ||
if ($@) { | ||
print $@ . "\n"; | ||
fail "eval failed"; | ||
} | ||
else { | ||
ok 1, "$files[$idx]: eval modified "; | ||
} | ||
} | ||
done_testing(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package Dummy0; | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
|
||
sub test { | ||
my $val = 1; | ||
my $val2 = "__END__"; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package Dummy0;sub wrapper_0 { | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
|
||
sub test { | ||
my $val = 1; | ||
my $val2 = "__END__"; | ||
} | ||
|
||
} wrapper_0();1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package Dummy1; | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
=head3 test2() | ||
This is a comment for this function containing evil characters | ||
1; | ||
=cut | ||
sub test2 { | ||
my $val = 1; | ||
my $val2 = "__DATA__"; | ||
} | ||
|
||
|
||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package Dummy1;sub wrapper_1 { | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
=head3 test2() | ||
|
||
This is a comment for this function containing evil characters | ||
1; | ||
|
||
=cut | ||
sub test2 { | ||
my $val = 1; | ||
my $val2 = "__DATA__"; | ||
} | ||
|
||
|
||
|
||
} wrapper_1();1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package Dummy2; | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
|
||
sub test3 { | ||
my $val = "hello"; | ||
my $val2 = "__END__"; | ||
} | ||
|
||
my $t = sub { | ||
my $hello = 1; | ||
}; | ||
|
||
|
||
|
||
1; | ||
|
||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package Dummy2;sub wrapper_2 { | ||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
|
||
sub test3 { | ||
my $val = "hello"; | ||
my $val2 = "__END__"; | ||
} | ||
|
||
our $t = sub { | ||
my $hello = 1; | ||
}; | ||
|
||
|
||
|
||
1; | ||
|
||
} wrapper_2();__END__ |
Oops, something went wrong.