Skip to content

Commit

Permalink
ignore commented out error message (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Nov 11, 2022
1 parent 1275db8 commit 5919fe6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/perl.json → scripts/perl.json
Expand Up @@ -4,7 +4,7 @@
"owner": "perl",
"pattern": [
{
"regexp": "^(.+)\\sat\\s(.+)\\sline\\s(\\d+)\\.$",
"regexp": "^\\s*([^#\\s].+)\\sat\\s(.+)\\sline\\s(\\d+)\\.$",
"file": 2,
"line": 3,
"message": 1
Expand Down
21 changes: 21 additions & 0 deletions scripts/t/05_problem_matcher.t
@@ -0,0 +1,21 @@
use Test::More;
use JSON::PP qw/decode_json/;

open my $fh, '<', 'perl.json' or die "$!";
my $data = do {local $/; <$fh>};
close $fh;

my $matcher = decode_json($data);
my $problem_matcher = $matcher->{problemMatcher};
my $regexp = $problem_matcher->[0]{pattern}[0]{regexp};
diag $regexp;

like 'Bareword "foobar" not allowed while "strict subs" in use at t/errors.pl line 4.', qr/$regexp/, 'systax error';
like 'some error!! at t/errors.pl line 4.', qr/$regexp/, 'die';
like 'some # error!! at t/errors.pl line 4.', qr/$regexp/, 'die';

# from: https://github.com/shogo82148/actions-setup-perl/issues/1302
unlike ' # at /home/runner/work/perlTest/perlTest/t/FHEM/98_HELLO/00_define.t line 21.', qr/$regexp/, 'issue 1302';
unlike "# at /home/runner/work/perlTest/perlTest/t/FHEM/98_HELLO/00_define.t line [22]", qr/$regexp/, 'issue 1302';
done_testing;

4 changes: 4 additions & 0 deletions scripts/t/errors.pl
@@ -0,0 +1,4 @@
use strict;
use warnings;

die "some # error!!";
4 changes: 2 additions & 2 deletions src/setup-perl.ts
Expand Up @@ -47,8 +47,8 @@ async function run() {
perlHash = await digestOfPerlVersion(result.path);
core.setOutput("perl-hash", perlHash);

const matchersPath = path.join(__dirname, "..", ".github");
console.log(`##[add-matcher]${path.join(matchersPath, "perl.json")}`);
const matchersPath = path.join(__dirname, "..", "scripts");
console.log(`::add-matcher::${path.join(matchersPath, "perl.json")}`);

// for pre-installed scripts
core.addPath(path.join(__dirname, "..", "bin"));
Expand Down

0 comments on commit 5919fe6

Please sign in to comment.