Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore commented out error message #1326

Merged
merged 1 commit into from Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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