diff options
Diffstat (limited to 't/02-back-compat.t')
-rw-r--r-- | t/02-back-compat.t | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/02-back-compat.t b/t/02-back-compat.t new file mode 100644 index 0000000..e8bc3e4 --- /dev/null +++ b/t/02-back-compat.t @@ -0,0 +1,23 @@ +#!perl +use Test::Most tests=>3,'die'; +use strict; +use warnings; +use PPI; +use PPIx::XPath; + +my $x=PPIx::XPath->new(\<<'EOF'); +sub foo { print "bar" } + +baz(); +EOF + +#explain('the doc: ',$x->{doc}); + +my ($subdef) = $x->match('/Statement::Sub'); +is($subdef->name,'foo','Got the sub'); + +my ($string) = $x->match('/Statement::Sub/Structure::Block/Statement/Token::Quote::Double'); +is($string->string,'bar','Got the string'); + +my ($call) = $x->match('/Statement/Token::Word'); +is($call->literal,'baz','Got the call'); |