Permalink
Browse files

Actually test the PerlX::MethodCallWithBlock examples.

  • Loading branch information...
1 parent a2dae36 commit 3f516c6fe2821ff05872053668c3ac539f1efb9b @theory committed Sep 5, 2009
Showing with 15 additions and 0 deletions.
  1. +2 −0 lib/Test/XPath.pm
  2. +13 −0 t/ex.t
View
@@ -159,6 +159,8 @@ Test::XPath - Test XML and HTML content and structure with XPath expressions
# Better yet, use PerlX::MethodCallWithBlock:
use PerlX::MethodCallWithBlock;
+ my @css = qw(foo.css bar.css);
+ use PerlX::MethodCallWithBlock;
$tx->ok( '/html/head/style[@type="text/css"]', 'Should have style' ) {
my $css = shift @css;
shift->is( './@src', $css, "Style src should be $css");
View
13 t/ex.t
@@ -33,6 +33,13 @@ XML
shift->is( './@src', $css, "Style src should be $css");
}, 'Should have style' );
+ # Better yet, use PerlX::MethodCallWithBlock:
+ # @css = qw(foo.css bar.css);
+ # use PerlX::MethodCallWithBlock;
+ # $tx->ok( '/html/head/style[@type="text/css"]', 'Should have style' ) {
+ # my $css = shift @css;
+ # shift->is( './@src', $css, "Style src should be $css");
+ # };
# ok()
@@ -50,6 +57,12 @@ $tx = Test::XPath->new( xml => '<assets><story id="1" /><story id="2" /></assets
shift->is('./@id', ++$i, "ID should be $i in story $i");
}, 'Should have story elements' );
+ # use PerlX::MethodCallWithBlock;
+ # $i = 0;
+ # $tx->ok( '//assets/story', 'Should have story elements' ) {
+ # shift->is('./@id', ++$i, "ID should be $i in story $i");
+ # };
+
# ok() deep atom example.
$tx = Test::XPath->new( file => catfile(qw(t atom.xml)) );

0 comments on commit 3f516c6

Please sign in to comment.