summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@sardina.(none)>2009-06-28 11:31:00 +0200
committerdakkar <dakkar@sardina.(none)>2009-06-28 11:31:00 +0200
commit446265157644e77d08b7df515815c7f3cdc2d481 (patch)
tree4abc78af8e4e942ebd757ae72942508b3438c129
parentstill broken (diff)
downloadTree-Transform-XSLTish-446265157644e77d08b7df515815c7f3cdc2d481.tar.gz
Tree-Transform-XSLTish-446265157644e77d08b7df515815c7f3cdc2d481.tar.bz2
Tree-Transform-XSLTish-446265157644e77d08b7df515815c7f3cdc2d481.zip
won't use PPIx::Class 1.x, it's too broken
we'll try to have PPIx::Class 2.x accepted by the author
-rw-r--r--t/07-class-xpath.t45
1 files changed, 6 insertions, 39 deletions
diff --git a/t/07-class-xpath.t b/t/07-class-xpath.t
index 9aa8040..7702993 100644
--- a/t/07-class-xpath.t
+++ b/t/07-class-xpath.t
@@ -2,42 +2,19 @@
package main;
use Test::Most 'die';
BEGIN {
- eval 'use PPIx::XPath';
- plan skip_all => 'PPIx::XPath needed for this test' if $@;
-}
-
-package CXpEngine; {
-use PPIx::XPath;
-sub new { bless {},shift }
-sub findnodes {
- my ($self,$expr,$node)=@_;
- return PPIx::XPath->new($node)->match($expr);
-}
-
-sub PPI::Document::parent {
- return $_[0];
-}
+ eval 'use PPIx::XPath 2.00';
+ plan skip_all => 'PPIx::XPath 2.00 needed for this test' if $@;
}
package PPITransform;{
- use Tree::Transform::XSLTish ':engine';
+ use Tree::Transform::XSLTish;
use strict;
use warnings;
- engine_class 'CXpEngine';
+ default_rules;
- #default_rules;
- tree_rule match => '/', priority => 0, action => sub {
- print '# root';
- $_[0]->apply_rules
- };
- tree_rule match => '*', priority => 0, action => sub {
- print '# ',$_[0]->it->xpath;
- $_[0]->apply_rules
- };
-
- tree_rule match => 'Statement::Sub', action => sub {
- return $_[0]->it->name.'('.$_[0]->it->prototype.')';
+ tree_rule match => 'Statement-Sub', action => sub {
+ return $_[0]->it->name.$_[0]->it->prototype;
};
}
@@ -46,7 +23,6 @@ package main;
use strict;
use warnings;
use PPI;
-use Devel::TraceCalls;
plan tests=>1;
@@ -58,16 +34,7 @@ sub pino {}
gino(\&pino,{1=>2});
EOP
-my $x=PPIx::XPath->new($doc);
-diag "$_\n" for $x->match('//Statement::Sub');
-
my $trans=PPITransform->new();
-#trace_calls {
-# Package => 'PPIx::XPath',
-# Class => 'PPI::Node',
-# ShowStack => 1,
-# CaptureAll => 1,
-#};
my @results=$trans->transform($doc);
is_deeply \@results,['gino($%)','pino'],'PPI example';