From 446265157644e77d08b7df515815c7f3cdc2d481 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 28 Jun 2009 11:31:00 +0200 Subject: won't use PPIx::Class 1.x, it's too broken we'll try to have PPIx::Class 2.x accepted by the author --- t/07-class-xpath.t | 45 ++++++--------------------------------------- 1 file 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'; -- cgit v1.2.3