-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also started filling out the outline of the docs more thoroughly. I think I just need to spend a few hours making really good docs and this baby will be ready to go!
- Loading branch information
Showing
2 changed files
with
96 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/perl -w | ||
|
||
use strict; | ||
|
||
use Test::More tests => 5; | ||
use Test::XPath; | ||
|
||
my $xml = <<'XML'; | ||
<html> | ||
<head> | ||
<title>Hello</title> | ||
<style type="text/css" src="foo.css"></style> | ||
<style type="text/css" src="bar.css"></style> | ||
</head> | ||
<body> | ||
<h1>Welcome to my lair.</h1> | ||
</body> | ||
</html> | ||
XML | ||
|
||
my $tx = Test::XPath->new( xml => $xml ); | ||
|
||
$tx->ok( '/html/head', 'There should be a head' ); | ||
$tx->is( '/html/head/title', 'Hello', 'The title should be correct' ); | ||
|
||
# Recursing into a document: | ||
my @css = qw(foo.css bar.css); | ||
$tx->ok( '/html/head/style[@type="text/css"]', sub { | ||
my $css = shift @css; | ||
shift->is( './@src', $css, "Style src should be $css"); | ||
}, 'Should have style'); |