summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2009-08-12 17:22:06 +0200
committerdakkar <dakkar@thenautilus.net>2009-08-12 17:22:06 +0200
commit21427fe4d2b0e8237dc6a30b69a8f41b945b46ec (patch)
treeb415afb2571c61df82df12a71799ebc48690aedd /t
parentfirst apparently working version (diff)
downloadPPIx-XPath-21427fe4d2b0e8237dc6a30b69a8f41b945b46ec.tar.gz
PPIx-XPath-21427fe4d2b0e8237dc6a30b69a8f41b945b46ec.tar.bz2
PPIx-XPath-21427fe4d2b0e8237dc6a30b69a8f41b945b46ec.zip
added back-compatibility
actually tested it: 02-back-compat passes on both PPIx::XPath 1.0.0 and PPIx::XPath 2.0
Diffstat (limited to 't')
-rw-r--r--t/01-use.t3
-rw-r--r--t/02-back-compat.t23
2 files changed, 26 insertions, 0 deletions
diff --git a/t/01-use.t b/t/01-use.t
new file mode 100644
index 0000000..9848444
--- /dev/null
+++ b/t/01-use.t
@@ -0,0 +1,3 @@
+#!perl
+use Test::Most tests=>1,'bail';
+use_ok('PPIx::XPath');
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');