summaryrefslogtreecommitdiff
path: root/t/02-back-compat.t
blob: e8bc3e4e9087223e7fb8fb5a66a45614ca7777d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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');