Skip to content

Commit

Permalink
test actionlint-matcher.json against testdata/err/*.out
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 17, 2021
1 parent ad5ddc0 commit 3d6a61b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/matcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Problem Matchers
on:
push:
paths:
- 'scripts/generate-actionlint-matcher/object.js'
- 'scripts/generate-actionlint-matcher/*.js'
- 'testdata/examples/*.out'
- 'testdata/err/*.out'
branches:
- main
tags-ignore:
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate-actionlint-matcher/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const regexp = new RegExp(pattern.regexp);
}
}

{
const dir = path.join(__dirname, '..', '..', 'testdata', 'examples');
for (const parent of ['examples', 'err']) {
const dir = path.join(__dirname, '..', '..', 'testdata', parent);
for (const name of fs.readdirSync(dir)) {
if (!name.endsWith('.out')) {
continue;
}
console.log(`Testing testdata/examples/${name}`);
console.log(`Testing testdata/${parent}/${name}`);
for (const line of fs.readFileSync(path.join(dir, name), 'utf8').split('\n')) {
if (line.length === 0 || line.startsWith('/')) {
continue
Expand All @@ -42,6 +42,6 @@ const regexp = new RegExp(pattern.regexp);
assert.ok(m[pattern.message].length > 0, msg);
assert.ok(m[pattern.code].length > 0, msg);
}
console.log(`Success testdata/examples/${name}`);
console.log(`Success testdata/${parent}/${name}`);
}
}

0 comments on commit 3d6a61b

Please sign in to comment.