summaryrefslogtreecommitdiff
path: root/t/07-ppix-class.t
blob: 770299334c768305d6d287d7c1e260e44a8fc8ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!perl 
package main; 
use Test::Most 'die';
BEGIN {
    eval 'use PPIx::XPath 2.00';
    plan skip_all => 'PPIx::XPath 2.00 needed for this test' if $@;
}
 
package PPITransform;{ 
 use Tree::Transform::XSLTish;
 use strict;
 use warnings;
 
 default_rules;
 
 tree_rule match => 'Statement-Sub'action => sub {
     return $_[0]->it->name.$_[0]->it->prototype;
 };
 
}
 
package main; 
use strict;
use warnings;
use PPI;
 
plan tests=>1;
 
{
my $doc=PPI::Document->new(\<<'EOP');
sub gino($%) {}
sub pino {}
 
gino(\&pino,{1=>2});
EOP
 
my $trans=PPITransform->new();
 
my @results=$trans->transform($doc);
is_deeply \@results,['gino($%)','pino'],'PPI example';
}