ast-grepのruleのtest
https://ast-grep.github.io/guide/test-rule.html#test-setup
ast-grepのrule自体のtestを書けるらしい
code:yml
id: no-await-in-loop
valid:
- for (let a of b) { console.log(a) }
# .... more valid test cases
invalid:
- async function foo() { for (var bar of baz) await bar; }
# .... more invalid test cases
個別のruleに対し、
matchすべきもの、matchすべきでないものの例を列挙する感じ
ちなみに、Snapshot Testingもできるらしい
https://ast-grep.github.io/guide/test-rule.html#snapshot-test