Skip to content

Instantly share code, notes, and snippets.

@masak
Last active March 25, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/ba06dbb58fc01228ef5e to your computer and use it in GitHub Desktop.
Save masak/ba06dbb58fc01228ef5e to your computer and use it in GitHub Desktop.
A nicer version with XPath searches
use v6;
use Test;
use _007::Test;
my $actions-ast = xpath(qast-of("lib/_007/Parser/Actions.pm"));
for $actions-ast.find("//method") -> $method {
my @constructions = $method.find: '//callmethod[@name="new"]/wval[1][@name="Q::Block"]';
my @finishblocks = $method.find: '//callmethod[@name="finish-block"]/lexical[1][@name="self"]';
is +@constructions, +@finishblocks, "finished all Q::Block.new in {$method.name}";
}
done-testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment