Refactor tests (first pass)
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 26 Dec 2014 11:37:55 +0000 (13:37 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 27 Dec 2014 09:34:06 +0000 (11:34 +0200)
63 files changed:
lib/HTML/Element/Library.pm
t/00system.t
t/HTML-Element-Library.t [deleted file]
t/content_handler.t
t/crunch.t
t/defmap.t
t/dual_iter.t
t/fillinform.t
t/hashmap.t
t/highlander.t
t/highlander2.t
t/html/crunch.exp [new file with mode: 0644]
t/html/crunch.html [new file with mode: 0644]
t/html/crunch/crunch.exp [deleted file]
t/html/crunch/crunch.initial [deleted file]
t/html/defmap.exp [new file with mode: 0644]
t/html/defmap.html [new file with mode: 0644]
t/html/defmap/defmap.exp [deleted file]
t/html/defmap/defmap.initial [deleted file]
t/html/dual_iter.exp
t/html/fillinform.exp [new file with mode: 0644]
t/html/fillinform.html [new file with mode: 0644]
t/html/fillinform/fillinform.exp [deleted file]
t/html/fillinform/fillinform.initial [deleted file]
t/html/hashmap.exp [new file with mode: 0644]
t/html/hashmap.html [new file with mode: 0644]
t/html/highlander-15.exp
t/html/highlander-5.exp
t/html/highlander-50.exp
t/html/highlander2-15.exp
t/html/highlander2-27.exp
t/html/highlander2-5.exp
t/html/highlander2-passover.exp
t/html/iter.exp
t/html/iter.html
t/html/iter2.exp
t/html/iter2.html
t/html/same_as.html [deleted file]
t/html/same_as/same_as.exp [deleted file]
t/html/same_as/same_as.initial [deleted file]
t/html/table-alt.exp
t/html/table.exp
t/html/table2-tr_ld-coderef.html [deleted file]
t/html/table2-tr_ld-default.html [deleted file]
t/html/table2-tr_ld_coderef.exp [deleted file]
t/iter.t
t/iter2.t
t/lib.pm [new file with mode: 0644]
t/newchild.t
t/passover.t
t/position.t
t/prune.t
t/replace_content.t
t/set_child_content.t
t/sibdex.t
t/siblings.t
t/table-alt.t
t/table.t
t/table2-table_ld.t
t/table2-tr_ld.t
t/table2.t
t/unroll_select.t
t/wrap_content.t

index 5336eefe4650c91746da1864d49d3e6970b3637a..553fb0c2585f3a2ee370eda7d3fc16d1745fc4c3 100644 (file)
@@ -301,13 +301,13 @@ sub HTML::Element::iter2 { ## no critic (RequireArgUnpacking)
                my $item_data  = $p{item_data}->($p{wrapper_data});
                last unless defined $item_data;
 
-               warn Dumper('item_data', $item_data);
+               warn Dumper('item_data', $item_data) if $p{debug};
 
                my $item_elems = [ map { $_->clone } @{$_item_elems} ] ;
 
                if ($p{debug}) {
                        for (@{$item_elems}) {
-                               warn 'ITEM_ELEMS ', $_->as_HTML;
+                               warn 'ITEM_ELEMS ', $_->as_HTML if $p{debug};
                        }
                }
 
@@ -315,7 +315,7 @@ sub HTML::Element::iter2 { ## no critic (RequireArgUnpacking)
 
                if ($p{debug}) {
                        for (@{$new_item_elems}) {
-                               warn 'NEWITEM_ELEMS ', $_->as_HTML;
+                               warn 'NEWITEM_ELEMS ', $_->as_HTML if $p{debug};
                        }
                }
 
index 10066ce437526ccfc602b98ee68c62c7bccbe505..4801fe4280c41dde11beb34ca260316d8f565f11 100644 (file)
@@ -1,46 +1,13 @@
-# Welcome to a -*- perl -*- test script
+#!/usr/bin/perl
 use strict;
-use Test::More qw(no_plan);
+use warnings;
 
-sub req_ver {
-  my $string = shift;
-  my $eval = "#Using $string version v\$${string}::VERSION\n";
-  my $eval2 = sprintf 'warn "%s"', $eval;
-  require_ok($string);
-  eval  $eval2 ;
-}
+use Test::More tests => 1;
 
-my @module = 
-  qw(
-     Array::Group 
-     File::Slurp
-
-     HTML::PrettyPrinter 
-     HTML::Tree 
-     HTML::Element
-     HTML::Parser 
-     HTML::Entities 
-     HTML::Tagset 
-
-     List::Rotation::Cycle
-     List::MoreUtils
-
-     Params::Validate
-
-     Scalar::Listify
-    ) ;
-
-req_ver($_) for @module;
-
-warn "# Running under perl version $] for $^O",
-  (chr(65) eq 'A') ? "\n" : " in a non-ASCII world\n";
-warn "# Win32::BuildNumber ", &Win32::BuildNumber(), "\n"
-  if defined(&Win32::BuildNumber) and defined &Win32::BuildNumber();
-warn "# MacPerl verison $MacPerl::Version\n"
-  if defined $MacPerl::Version;
-warn sprintf
-  "# Current time local: %s\n# Current time GMT:   %s\n",
-  scalar(localtime($^T)), scalar(gmtime($^T));
-  
-ok 1;
+diag "Running under perl version $] for $^O",  (chr(65) eq 'A') ? "\n" : " in a non-ASCII world\n";
+diag "Win32::BuildNumber ", &Win32::BuildNumber(), "\n" if defined(&Win32::BuildNumber) and defined &Win32::BuildNumber();
+diag "MacPerl verison $MacPerl::Version\n" if defined $MacPerl::Version;
+diag sprintf "Current time local: %s\n", scalar localtime;
+diag sprintf "Current time GMT:   %s\n", scalar gmtime;
 
+pass;
diff --git a/t/HTML-Element-Library.t b/t/HTML-Element-Library.t
deleted file mode 100644 (file)
index 83f9e44..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl HTML-Element-Library.t'
-
-#########################
-
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test;
-BEGIN { plan tests => 1 };
-use HTML::Element::Library;
-ok(1); # If we made it this far, we're ok.
-
-#########################
-
-# Insert your test code below, the Test::More module is use()ed here so read
-# its man page ( perldoc Test::More ) for help writing this test script.
-
index 8264d702f197c50ec8ed90de4329de2b20878490..5a2b203ee2c6e2cec383ce79f85dbb5f7cc84c61 100644 (file)
@@ -1,33 +1,15 @@
-use strict;
-use Test::More qw(no_plan);
+#!/usr/bin/perl
+use t::lib tests => 1;
+
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', 'um, p < 4!', {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body', {id => 'corpus'},
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 'um, p < 4!', {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
-
-
-#$t1->look_down('_tag' => 'body')->replace_content('all gone!');
 $t1->content_handler(corpus => 'all gone!');
-is( $t1->as_HTML, '<html><head><title>I like stuff!</title></head><body id="corpus" lang="en-JP">all gone!</body></html>', "replaced all of body");
-
-
+isxml $t1, \'<html><head><title>I like stuff!</title></head><body id="corpus" lang="en-JP">all gone!</body></html>', 'content_handler';
index 627ef2a3d6320119d37942fce2fc83a21d38d95c..241cc3fb089e58c77e648e7f024eab3695e56305 100644 (file)
@@ -1,25 +1,6 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;use warnings;
+#!/usr/bin/perl
+use t::lib tests => 1;
 
-use File::Slurp qw/read_file/;
-use Test::More;
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub tage {
-
-  my $root = "t/html/crunch/crunch";
-
-  my $tree = HTML::TreeBuilder->new_from_file("$root.initial")->guts;
-
-  $tree->crunch(look_down => [ class => 'imageElement' ], leave => 1);
-
-  is_xml $tree->as_XML, scalar read_file("$root.exp"), 'XML for crunch';
-}
-
-
-tage();
-
-done_testing;
+my $tree = mktree 't/html/crunch.html';
+$tree->crunch(look_down => [ class => 'imageElement' ], leave => 1);
+isxml $tree, 't/html/crunch.exp', 'crunch';
index 26eeeedcdf577faa3594450a540a92dc135c7c5a..880b998d130a525c874e2fc248a4de3ee34aa6df 100644 (file)
@@ -1,32 +1,6 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;use warnings;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-use Test::XML;
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-
-sub tage {
-
-  my $root = "t/html/defmap/defmap";
-
-  my $tree = HTML::TreeBuilder->new_from_file("$root.initial")->guts;
-
-  #warn "TREE: $tree" . $tree->as_HTML;
-
-  my %data = (pause => 'arsenal rules');
-
-  $tree->defmap(smap => \%data, 1);
-
-  my $g = $tree->as_XML;
-  my $e = File::Slurp::read_file("$root.exp");
-  warn "generated:$g:\nexpected:$e:";
-
-  is_xml ($g, $e, "XML for defmap");
-}
-
-
-tage();
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $tree = mktree 't/html/defmap.html';
+$tree->defmap(smap => {pause => 'arsenal rules'}, $ENV{TEST_VERBOSE});
+isxml $tree, 't/html/defmap.exp', 'defmap';
index dbcfb28adf0f5159c44b17c1b98f1240634b979e..2c93fd4c754ea5ddaa5d4fa566dc00426670c762 100644 (file)
@@ -1,51 +1,25 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-# this is a simpler call to iter2()
-
-my $root = 't/html/dual_iter';
-
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-my $dl = $tree->look_down(id => 'service_plan');
-
-
-my @items = (
-  ['the pros' => 'never have to worry about service again'],
-  ['the cons' => 'upfront extra charge on purchase'],
-  ['our choice' => 'go with the extended service plan']
- );
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $tree = mktree 't/html/dual_iter.html';
 
 $tree->iter2(
-
-  wrapper_data => \@items,
-
-  wrapper_proc => sub {
-    my ($container) = @_;
-
-    # only keep the last 2 dts and dds
-    my @content_list = $container->content_list;
-    $container->splice_content(0, @content_list - 2); 
-  },
-
-
-  splice       => sub {
-    my ($container, @item_elems) = @_;
-    $container->unshift_content(@item_elems);
-  },
-
-  debug        => 1,
-
- );
-
-
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 
-      "XML for generated li");
+       wrapper_data => [
+               ['the pros' => 'never have to worry about service again'],
+               ['the cons' => 'upfront extra charge on purchase'],
+               ['our choice' => 'go with the extended service plan']
+       ],
+       wrapper_proc => sub {
+               my ($container) = @_;
+               # only keep the last 2 dts and dds
+               my @content_list = $container->content_list;
+               $container->splice_content(0, @content_list - 2);
+       },
+       splice       => sub {
+               my ($container, @item_elems) = @_;
+               $container->unshift_content(@item_elems);
+       },
+       debug        => $ENV{TEST_VERBOSE},
+);
+
+isxml $tree, 't/html/dual_iter.exp', 'dual_iter';
index d989f4e4c2c3ac14c1b7f810545f647c190c1619..1d88b2a105ab167aeb5beb9d9bce24f64fcfdab9 100644 (file)
@@ -1,26 +1,5 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;use warnings;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub tage {
-
-  my $root = "t/html/fillinform/fillinform";
-
-  my $tree = HTML::TreeBuilder->new_from_file("$root.initial")->guts;
-
-  my %data = (state => 'catatonic');
-
-  my $new_tree = HTML::TreeBuilder->new_from_content( $tree->fillinform(\%data) ) ;
-
-  is_xml ($new_tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "HTML for fillinform");
-}
-
-
-tage();
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $tree = mktree 't/html/fillinform.html';
+isxml \($tree->fillinform({state => 'catatonic'})), 't/html/fillinform.exp', 'fillinform';
index 9ed28641c89cb8af7867b0e6a99e8fd4f6794a2d..ed81f068712f652ddef34e49e5a6da7def50105d 100644 (file)
@@ -1,38 +1,10 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub replace_age { 
-  my $branch = shift;
-  my $age = shift;
-  $branch->look_down(id => 'age')->replace_content($age);
-}
-
-
-sub tage {
-
-  my $root = "t/html/same_as/same_as";
-
-  my $tree = HTML::TreeBuilder->new_from_file("$root.initial");
-
-  #warn "TREE: $tree" . $tree->as_HTML;
-
-  my %data = (people_id => 888, phone => '444-4444', email => 'm@xml.com');
-
-  $tree->hash_map
-    (hash    => \%data, 
-     to_attr => 'sid', 
-     excluding => [ 'email' ]
-    );
-
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for same_as");
-}
-
-
-tage();
+#!/usr/bin/perl
+use t::lib tests => 1;
+
+my $tree = mktree 't/html/hashmap.html';
+$tree->hash_map(
+       hash      => {people_id => 888, phone => '444-4444', email => 'm@xml.com'},
+       to_attr   => 'sid',
+       excluding => ['email']
+);
+isxml $tree, 't/html/hashmap.exp', 'hash_map';
index e9f754c057738ea4074a72ed3a799074610594d3..c2249880445f17890d1fb18970a4d3b0da0f1f07 100644 (file)
@@ -1,33 +1,21 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub tage {
-  my $age = shift;
-  my $tree = HTML::TreeBuilder->new_from_file('t/html/highlander.html');
-
-
-  $tree->highlander
-    (age_dialog =>
-     [
-      under10 => sub { $_[0] < 10} , 
-      under18 => sub { $_[0] < 18} ,
-      welcome => sub { 1 }
-     ],
-     $age
-    );
-
-  my $root = "t/html/highlander-$age";
-
-  local $_; # XML::Parser does not like read-only $_ (RT #101129)
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for $age");
+#!/usr/bin/perl
+use t::lib tests => 3;
+
+sub test {
+       my $age = shift;
+       my $tree = mktree 't/html/highlander.html';
+
+       $tree->highlander(
+               age_dialog => [
+                       under10 => sub { $_[0] < 10 },
+                       under18 => sub { $_[0] < 18 },
+                       welcome => sub { 1 }
+               ],
+               $age
+       );
+
+       local $_; # XML::Parser does not like read-only $_ (RT #101129)
+       isxml $tree, "t/html/highlander-$age.exp", "highlander for $age";
 }
 
-
-tage($_) for qw(5 15 50);
+test $_ for qw(5 15 50);
index c145b6859b8601f0153999a5ddd475d8890a4d2e..dd8252dd43c2f3a06bbe09918c99db2d8dbf3d22 100644 (file)
@@ -1,48 +1,34 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
+#!/usr/bin/perl
+use t::lib tests => 3;
 
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub replace_age { 
-  my $branch = shift;
-  my $age = shift;
-  $branch->look_down(id => 'age')->replace_content($age);
+sub replace_age {
+       my ($branch, $age) = @_;
+       $branch->look_down(id => 'age')->replace_content($age);
 }
 
-
-sub tage {
-  my $age = shift;
-  my $tree = HTML::TreeBuilder->new_from_file('t/html/highlander2.html');
-  my $if_then = $tree->look_down(id => 'age_dialog');
-
-  $if_then->highlander2(
-    cond => [
-      under10 => [
-       sub { $_[0] < 10} , 
-       \&replace_age
-       ],
-      under18 => [
-       sub { $_[0] < 18} ,
-       \&replace_age
-       ],
-      welcome => [
-       sub { 1 },
-       \&replace_age
-       ]
-     ],
-    cond_arg => [ $age ]
-                      );
-
-  my $root = "t/html/highlander2-$age";
-
-  local $_; # XML::Parser does not like read-only $_ (RT #101129)
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "HTML for $age");
+sub test {
+       my $age = shift;
+       my $tree = mktree 't/html/highlander2.html';
+       my $if_then = $tree->look_down(id => 'age_dialog')->highlander2(
+               cond => [
+                       under10 => [
+                               sub { $_[0] < 10 },
+                               \&replace_age
+                       ],
+                       under18 => [
+                               sub { $_[0] < 18 },
+                               \&replace_age
+                       ],
+                       welcome => [
+                               sub { 1 },
+                               \&replace_age
+                       ]
+               ],
+               cond_arg => [ $age ]
+       );
+
+       local $_; # XML::Parser does not like read-only $_ (RT #101129)
+       isxml ($tree, "t/html/highlander2-$age.exp", "highlander2 for age $age");
 }
 
-
-tage($_) for qw(5 15 27);
+test $_ for qw(5 15 27);
diff --git a/t/html/crunch.exp b/t/html/crunch.exp
new file mode 100644 (file)
index 0000000..272e334
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+  <head>
+<script src="smooth/scripts/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
+<script src="smooth/scripts/mootools-1.2-more.js" type="text/javascript"></script>
+<script src="smooth/scripts/jd.gallery.js" type="text/javascript"></script>
+    <link rel="stylesheet" href="smooth/css/jd.gallery.css"
+      media="screen" type="text/css"/>
+  </head>
+  <body>
+<script type="text/javascript">
+function startGallery() {
+var myGallery = new gallery($('myGallery'), {
+timed: true
+});
+}
+window.addEvent('domready', startGallery);
+</script>
+    <div id="myGallery">
+      <div class="imageElement">
+        <h3>Item 1 Title</h3>
+        <p>Item 1 Description</p>
+        <a href="gallery-images/item-1/" title="open image" class="open"></a>
+        <img alt="Item 1 Title"
+          src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-gallery.jpg"
+          class="full"/> <img alt="thumbnail of Item 1 Title"
+          src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-mini.jpg"
+          class="thumbnail"/></div>
+    </div>
+  </body>
+</html>
diff --git a/t/html/crunch.html b/t/html/crunch.html
new file mode 100644 (file)
index 0000000..01353d1
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+  <head>
+
+    <script src="smooth/scripts/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
+    <script src="smooth/scripts/mootools-1.2-more.js" type="text/javascript"></script>
+    <script src="smooth/scripts/jd.gallery.js" type="text/javascript"></script> 
+
+    <link rel="stylesheet" href="smooth/css/jd.gallery.css" type="text/css" media="screen" />
+
+  </head>
+  <body>
+
+<script type="text/javascript">
+function startGallery() {
+var myGallery = new gallery($('myGallery'), {
+timed: true
+});
+}
+window.addEvent('domready', startGallery);
+</script> 
+
+    <div id="myGallery">
+
+      <div class="imageElement">
+       <h3>Item 1 Title</h3>
+       <p>Item 1 Description</p>
+<a href="gallery-images/item-1/" title="open image" class="open"></a>
+
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-gallery.jpg" class="full" alt="Item 1 Title" />
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-mini.jpg" class="thumbnail" alt="thumbnail of Item 1 Title" />
+      </div>
+
+      <div class="imageElement">
+       <h3>Item 2 Title</h3>
+       <p>Item 2 Description</p>
+<a href="gallery-images/item-1/" title="open image" class="open"></a>
+
+       <img src="http://lh3.ggpht.com/_Pu5idg9RIVo/S1G0Krsr6iI/AAAAAAAAAB8/Hzl-tKkclmo/s640/IMG_0488.jpg" class="full" alt="Item 2 Title" />
+       <img src="http://lh3.ggpht.com/_Pu5idg9RIVo/S1G0Krsr6iI/AAAAAAAAAB8/Hzl-tKkclmo/s128/IMG_0488.jpg" class="thumbnail" alt="thumbnail of Item 2 Title" />
+      </div>
+
+      <div class="imageElement">
+       <h3>Item 2 Title</h3>
+       <p>Item 2 Description</p>
+<a href="gallery-images/item-1/" title="open image" class="open"></a>
+
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/165392_5486-gallery.jpg" class="full" alt="Item 2 Title" />
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/165392_5486-mini.jpg" class="thumbnail" alt="thumbnail of Item 2 Title" />
+      </div>
+
+      <div class="imageElement">
+
+       <h3>Item 3 Title</h3>
+       <p>Item 3 Description</p>
+<a href="gallery-images/item-1/" title="open image" class="open"></a>
+
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/83808_7948-gallery.jpg" class="full" alt="Item 3 Title" />
+       <img src="http://smoothgallery.jondesign.net/assets/images/samples/83808_7948-mini.jpg" class="thumbnail" alt="thumbnail of Item 3 Title" />
+      </div>
+    </div>
+
+
+  </body>
+
+</html>
diff --git a/t/html/crunch/crunch.exp b/t/html/crunch/crunch.exp
deleted file mode 100644 (file)
index 272e334..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-  <head>
-<script src="smooth/scripts/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
-<script src="smooth/scripts/mootools-1.2-more.js" type="text/javascript"></script>
-<script src="smooth/scripts/jd.gallery.js" type="text/javascript"></script>
-    <link rel="stylesheet" href="smooth/css/jd.gallery.css"
-      media="screen" type="text/css"/>
-  </head>
-  <body>
-<script type="text/javascript">
-function startGallery() {
-var myGallery = new gallery($('myGallery'), {
-timed: true
-});
-}
-window.addEvent('domready', startGallery);
-</script>
-    <div id="myGallery">
-      <div class="imageElement">
-        <h3>Item 1 Title</h3>
-        <p>Item 1 Description</p>
-        <a href="gallery-images/item-1/" title="open image" class="open"></a>
-        <img alt="Item 1 Title"
-          src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-gallery.jpg"
-          class="full"/> <img alt="thumbnail of Item 1 Title"
-          src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-mini.jpg"
-          class="thumbnail"/></div>
-    </div>
-  </body>
-</html>
diff --git a/t/html/crunch/crunch.initial b/t/html/crunch/crunch.initial
deleted file mode 100644 (file)
index 01353d1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<html>
-  <head>
-
-    <script src="smooth/scripts/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
-    <script src="smooth/scripts/mootools-1.2-more.js" type="text/javascript"></script>
-    <script src="smooth/scripts/jd.gallery.js" type="text/javascript"></script> 
-
-    <link rel="stylesheet" href="smooth/css/jd.gallery.css" type="text/css" media="screen" />
-
-  </head>
-  <body>
-
-<script type="text/javascript">
-function startGallery() {
-var myGallery = new gallery($('myGallery'), {
-timed: true
-});
-}
-window.addEvent('domready', startGallery);
-</script> 
-
-    <div id="myGallery">
-
-      <div class="imageElement">
-       <h3>Item 1 Title</h3>
-       <p>Item 1 Description</p>
-<a href="gallery-images/item-1/" title="open image" class="open"></a>
-
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-gallery.jpg" class="full" alt="Item 1 Title" />
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/77196_6784-mini.jpg" class="thumbnail" alt="thumbnail of Item 1 Title" />
-      </div>
-
-      <div class="imageElement">
-       <h3>Item 2 Title</h3>
-       <p>Item 2 Description</p>
-<a href="gallery-images/item-1/" title="open image" class="open"></a>
-
-       <img src="http://lh3.ggpht.com/_Pu5idg9RIVo/S1G0Krsr6iI/AAAAAAAAAB8/Hzl-tKkclmo/s640/IMG_0488.jpg" class="full" alt="Item 2 Title" />
-       <img src="http://lh3.ggpht.com/_Pu5idg9RIVo/S1G0Krsr6iI/AAAAAAAAAB8/Hzl-tKkclmo/s128/IMG_0488.jpg" class="thumbnail" alt="thumbnail of Item 2 Title" />
-      </div>
-
-      <div class="imageElement">
-       <h3>Item 2 Title</h3>
-       <p>Item 2 Description</p>
-<a href="gallery-images/item-1/" title="open image" class="open"></a>
-
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/165392_5486-gallery.jpg" class="full" alt="Item 2 Title" />
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/165392_5486-mini.jpg" class="thumbnail" alt="thumbnail of Item 2 Title" />
-      </div>
-
-      <div class="imageElement">
-
-       <h3>Item 3 Title</h3>
-       <p>Item 3 Description</p>
-<a href="gallery-images/item-1/" title="open image" class="open"></a>
-
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/83808_7948-gallery.jpg" class="full" alt="Item 3 Title" />
-       <img src="http://smoothgallery.jondesign.net/assets/images/samples/83808_7948-mini.jpg" class="thumbnail" alt="thumbnail of Item 3 Title" />
-      </div>
-    </div>
-
-
-  </body>
-
-</html>
diff --git a/t/html/defmap.exp b/t/html/defmap.exp
new file mode 100644 (file)
index 0000000..f5aabd8
--- /dev/null
@@ -0,0 +1,5 @@
+<tr>
+  <td smap="active">Yes</td>
+  <td smap="pause">arsenal rules</td>
+  <td smap="hold">No</td>
+</tr>
diff --git a/t/html/defmap.html b/t/html/defmap.html
new file mode 100644 (file)
index 0000000..7e24e57
--- /dev/null
@@ -0,0 +1,7 @@
+<tr>
+        <td smap="active" >Yes</td>
+
+        <td smap="pause">No</td>
+
+        <td smap="hold">No</td>
+</tr>
diff --git a/t/html/defmap/defmap.exp b/t/html/defmap/defmap.exp
deleted file mode 100644 (file)
index f5aabd8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<tr>
-  <td smap="active">Yes</td>
-  <td smap="pause">arsenal rules</td>
-  <td smap="hold">No</td>
-</tr>
diff --git a/t/html/defmap/defmap.initial b/t/html/defmap/defmap.initial
deleted file mode 100644 (file)
index 7e24e57..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<tr>
-        <td smap="active" >Yes</td>
-
-        <td smap="pause">No</td>
-
-        <td smap="hold">No</td>
-</tr>
index 64c6c8f23472114db888189839f8a99826f76b24..c2e9d4489601c1f2d16869dbd196dd8a926bfa0c 100644 (file)
@@ -1,15 +1,10 @@
-<html>
-  <head></head>
-  <body>
-    <dl class="dual_iter" id="service_plan">
-      <dt class="adstyle">the pros</dt>
-      <dd class="adstyle2">never have to worry about service again</dd>
-      <dt class="adstyle">the cons</dt>
-      <dd class="adstyle2">upfront extra charge on purchase</dd>
-      <dt class="adstyle">our choice</dt>
-      <dd class="adstyle2">go with the extended service plan</dd>
-      <dt class="adstyle">sample header</dt>
-      <dd class="adstyle2">sample data</dd>
-    </dl>
-  </body>
-</html>
+<dl class="dual_iter" id="service_plan">
+  <dt class="adstyle">the pros</dt>
+  <dd class="adstyle2">never have to worry about service again</dd>
+  <dt class="adstyle">the cons</dt>
+  <dd class="adstyle2">upfront extra charge on purchase</dd>
+  <dt class="adstyle">our choice</dt>
+  <dd class="adstyle2">go with the extended service plan</dd>
+  <dt class="adstyle">sample header</dt>
+  <dd class="adstyle2">sample data</dd>
+</dl>
diff --git a/t/html/fillinform.exp b/t/html/fillinform.exp
new file mode 100644 (file)
index 0000000..75b3b6e
--- /dev/null
@@ -0,0 +1,18 @@
+<div>
+      <h1>Dialer</h1>
+      <form name="appform" id="appform" method="post">
+        <div id="city_div"> City:
+          <input name="city" type="text"/>
+        </div>
+        <div id="state_div"> State:
+          <input value="catatonic" name="state" type="text"/>
+        </div>
+        <div id="company_div"> Company:
+          <input name="company" type="text"/>
+        </div>
+        <div id="data_source_div"> Data Source:
+          <input name="data_source" type="text"/>
+        </div>
+        <input value="locate records" type="submit"/>
+      </form>
+</div>
diff --git a/t/html/fillinform.html b/t/html/fillinform.html
new file mode 100644 (file)
index 0000000..2661798
--- /dev/null
@@ -0,0 +1,21 @@
+  <div>
+    <h1>Dialer</h1>
+
+    <form id="appform" method="post" name="appform">
+      <div id="city_div">
+        City: <input type="text" name="city"/>
+      </div>
+
+      <div id="state_div">
+        State: <input type="text" name="state"/>
+      </div>
+
+      <div id="company_div">
+        Company: <input type="text" name="company"/>
+      </div>
+
+      <div id="data_source_div">
+        Data Source: <input type="text" name="data_source"/>
+      </div><input type="submit" value="locate records"/>
+    </form>
+  </div>
diff --git a/t/html/fillinform/fillinform.exp b/t/html/fillinform/fillinform.exp
deleted file mode 100644 (file)
index bbe603e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<html>
-  <head></head>
-  <body>
-    <div>
-      <h1>Dialer</h1>
-      <form name="appform" id="appform" method="post">
-        <div id="city_div"> City:
-          <input name="city" type="text"/>
-        </div>
-        <div id="state_div"> State:
-          <input value="catatonic" name="state" type="text"/>
-        </div>
-        <div id="company_div"> Company:
-          <input name="company" type="text"/>
-        </div>
-        <div id="data_source_div"> Data Source:
-          <input name="data_source" type="text"/>
-        </div>
-        <input value="locate records" type="submit"/>
-      </form>
-    </div>
-  </body>
-</html>
diff --git a/t/html/fillinform/fillinform.initial b/t/html/fillinform/fillinform.initial
deleted file mode 100644 (file)
index 2661798..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-  <div>
-    <h1>Dialer</h1>
-
-    <form id="appform" method="post" name="appform">
-      <div id="city_div">
-        City: <input type="text" name="city"/>
-      </div>
-
-      <div id="state_div">
-        State: <input type="text" name="state"/>
-      </div>
-
-      <div id="company_div">
-        Company: <input type="text" name="company"/>
-      </div>
-
-      <div id="data_source_div">
-        Data Source: <input type="text" name="data_source"/>
-      </div><input type="submit" value="locate records"/>
-    </form>
-  </div>
diff --git a/t/html/hashmap.exp b/t/html/hashmap.exp
new file mode 100644 (file)
index 0000000..22486ba
--- /dev/null
@@ -0,0 +1,15 @@
+<html>
+  <head>
+    <title>HO HO HA HA HA</title>
+  </head>
+  <body>
+    <table>
+      <tr align="left" sclass="tr" valign="top" class="alt">
+        <td sid="people_id">888</td>
+        <td sid="phone">444-4444</td>
+        <td sid="email"><a href="mailto:leave-me-alone@gmail.com" id="a_email"
+            >should-not-be-touched@seamstress.com</a></td>
+      </tr>
+    </table>
+  </body>
+</html>
diff --git a/t/html/hashmap.html b/t/html/hashmap.html
new file mode 100644 (file)
index 0000000..6d818cd
--- /dev/null
@@ -0,0 +1,16 @@
+<html>
+<head>
+  <title>HO HO HA HA HA</title>
+</head>
+
+<body>
+  <table>
+    <tr sclass="tr" class="alt" align="left" valign="top">
+      <td sid="people_id">1</td>
+      <td sid="phone">(877) 255-3239</td>
+      <td sid="email"><a id="a_email" href="mailto:leave-me-alone@gmail.com">should-not-be-touched@seamstress.com</a></td>
+    </tr>
+  </table>
+</body>
+
+</html>
\ No newline at end of file
index 48fe062c5826576ce9de23510baaec1a38374376..dbd4acf518291cf00933fcaea94511e98720d0e4 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="under18"> Sorry,
+<span id="age_dialog" klass="highlander"><span id="under18"> Sorry,
         you're not old enough to enter (and too dumb to lie about your age)
-      </span></span></body>
-</html>
+      </span></span>
index 96df6fc222dd6c5d997ccb092a142a52d5eb51ad..5baaa1d512e826443ecb978874ad5c2c9cfce85a 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="under10"> Hello,
+<span id="age_dialog" klass="highlander"><span id="under10"> Hello,
         does your mother know you're using her AOL account?
-      </span></span></body>
-</html>
+      </span></span>
index 1f03eddfb6a8c85d31985084ec6d96aec1f5c8ef..8511ff2b346cea365e297ac6b420c86c6c1fc39f 100644 (file)
@@ -1,5 +1,2 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="welcome"> Welcome
-      </span></span></body>
-</html>
+<span id="age_dialog" klass="highlander"><span id="welcome"> Welcome
+      </span></span>
index 20be935517f7f66fb2456cccf8285cdbf16b6d31..56bd4317581b924f00886ce3a07e80f80c5ea3ea 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="under18"> Sorry,
+<span id="age_dialog" klass="highlander"><span id="under18"> Sorry,
         you're only <span id="age">15</span> (and too dumb to lie about your
-        age) </span></span></body>
-</html>
+        age) </span></span>
index dd7b2fac3c7a9c28af6c1c87dd1f8c0120179df3..3671bbe06a8e380770652cc9082bbd2985d5cb46 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="welcome"> Welcome,
+<span id="age_dialog" klass="highlander"><span id="welcome"> Welcome,
         isn't it good to be <span id="age">27</span> years old?
-      </span></span></body>
-</html>
+</span></span>
index b62e6e0ba318e39eb9d8f4ddc8350a6ee3f9fae4..ecc6e8883c60e5ac7e9fa8299f54da837f65e758 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"><span id="under10"> Hello,
+<span id="age_dialog" klass="highlander"><span id="under10"> Hello,
         little <span id="age">5</span>-year old, does your mother know you're
-        using her AOL account? </span></span></body>
-</html>
+        using her AOL account? </span></span>
index 8de5305b27a10f9b55229f631c4aa0221e8e9e86..8bfaa650dec89917874da86b603f64dd66d0bc11 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body><span id="age_dialog" klass="highlander"> <span id="under18"> Sorry,
+<span id="age_dialog" klass="highlander"> <span id="under18"> Sorry,
         you're only <span id="age">AGE</span> (and too dumb to lie about your
-        age) </span> </span></body>
-</html>
+        age) </span> </span>
index 746633e9c4d745cd4a370aea5fff7a668b48e953..013b01918a77eec4b10a352557f47b722d8422ae 100644 (file)
@@ -1,10 +1,8 @@
-<html>
-  <head></head>
-  <body>Here are the things I need from the store:
+<body>
+Here are the things I need from the store:
     <ul>
       <li class="store_items">bread</li>
       <li class="store_items">butter</li>
       <li class="store_items">vodka</li>
     </ul>
-  </body>
-</html>
+</body>
index 289809f607cdd725214e5844dc0f8e1371a47724..3f609f1075f3c2a829a9e0e45a9568db4d8a5f0f 100644 (file)
@@ -1,4 +1,6 @@
+<body>
 Here are the things I need from the store:
 <ul>
 <li class="store_items">Sample item</li>
-</ul>
\ No newline at end of file
+</ul>
+</body>
index 17148cf0f9e73632e29c6d84fe9942145b6494a2..992ffa38bd92cd41b816c8ef6a693b11b1ba886c 100644 (file)
@@ -1,6 +1,5 @@
-<html>
-  <head></head>
-  <body>Here are the type of people you meet at XYZ, inc:
+<div>
+Here are the type of people you meet at XYZ, inc:
     <dl>
       <dt>Programmer</dt>
       <dd>one who likes Perl and Seamstress</dd>
@@ -11,5 +10,4 @@
       <dt> Poet </dt>
       <dd> A relative of Edgar Allan Poe. </dd>
     </dl>
-  </body>
-</html>
+</div>
index 1a936716ed6d54a32282c55bf1181c196a27420c..acb026e06ef9d3f90d16f99248a2027bafb3a6de 100644 (file)
@@ -1,3 +1,4 @@
+<div>
 Here are the type of people you meet at XYZ, inc:
 
     <dl>
@@ -25,3 +26,4 @@ Here are the type of people you meet at XYZ, inc:
 
 
     </dl>
+</div>
diff --git a/t/html/same_as.html b/t/html/same_as.html
deleted file mode 100644 (file)
index f70d378..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-<head>
-  <title>HO HO HA HA HA</title>
-</head>
-
-<body>
-  <table>
-    <tr sclass="tr" class="alt" align="left" valign="top">
-      <td sid="people_id">1</td>
-      <td sid="phone">(877) 255-3239</td>
-      <td sid="email"><a sid="a_email" href="mailto:jim@gmail.com">jim@gmail.com</a></td>
-    </tr>
-  </table>
-</body>
-
-</html>
\ No newline at end of file
diff --git a/t/html/same_as/same_as.exp b/t/html/same_as/same_as.exp
deleted file mode 100644 (file)
index 22486ba..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-  <head>
-    <title>HO HO HA HA HA</title>
-  </head>
-  <body>
-    <table>
-      <tr align="left" sclass="tr" valign="top" class="alt">
-        <td sid="people_id">888</td>
-        <td sid="phone">444-4444</td>
-        <td sid="email"><a href="mailto:leave-me-alone@gmail.com" id="a_email"
-            >should-not-be-touched@seamstress.com</a></td>
-      </tr>
-    </table>
-  </body>
-</html>
diff --git a/t/html/same_as/same_as.initial b/t/html/same_as/same_as.initial
deleted file mode 100644 (file)
index 6d818cd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-<head>
-  <title>HO HO HA HA HA</title>
-</head>
-
-<body>
-  <table>
-    <tr sclass="tr" class="alt" align="left" valign="top">
-      <td sid="people_id">1</td>
-      <td sid="phone">(877) 255-3239</td>
-      <td sid="email"><a id="a_email" href="mailto:leave-me-alone@gmail.com">should-not-be-touched@seamstress.com</a></td>
-    </tr>
-  </table>
-</body>
-
-</html>
\ No newline at end of file
index 60c9f06cef3ffd59605684b591ca1574658a5a58..9cff2c0d2f58f5b9070482fc58638dbedb9e2657 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body>
     <table class="supply" id="load_data">
       <tr>
         <th>name</th>
@@ -38,5 +35,3 @@
         <td id="weight">230</td>
       </tr>
     </table>
-  </body>
-</html>
index c11b8f4a5c94d3c13e2c10cfd0146ed5d7d46212..95b8566ad93ec7b0d7558562ff92f7ba44191f2a 100644 (file)
@@ -1,6 +1,3 @@
-<html>
-  <head></head>
-  <body>
     <table class="supply" id="load_data">
       <tr>
         <th>name</th>
@@ -38,5 +35,3 @@
         <td id="weight">230</td>
       </tr>
     </table>
-  </body>
-</html>
diff --git a/t/html/table2-tr_ld-coderef.html b/t/html/table2-tr_ld-coderef.html
deleted file mode 100644 (file)
index cffaba2..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <title>Complex HTML Table</title>
-  </head>
-
-  <body style="font-family: Arial, Helvetica, sans-serif" >
-    <h1>Complex HTML Table</h1>
-
-    <P>
-      This table comes from 
-      <a
-       href="http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.5">
-       the w3 spec on tables
-      </a>. I am using it to try out the <code>table2()</code> API call
-      that is part of the new release of 
-      <a
-       href=http://search.cpan.org/search?query=Element%3A%3ALibrary&mode=all>
-       <code>HTML::Element::Library</code>
-      </a>.
-    </p>
-
-    
-    <P>
-
-    <TABLE border="2" frame="hsides" rules="groups">
-      <CAPTION>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</CAPTION>
-      <COLGROUP align="center">
-      <COLGROUP align="left">
-      <COLGROUP align="center" span="2">
-      <COLGROUP align="center" span="3">
-      <THEAD valign="top">
-       <TR>
-         <TH>Code-Page<BR>ID
-         <TH>Name
-         <TH>ACP
-         <TH>OEMCP
-         <TH>Windows<BR>NT 3.1
-         <TH>Windows<BR>NT 3.51
-         <TH>Windows<BR>95
-         </th>
-       </tr>
-      <TBODY>
-       <TR><TD>1200<TD>Unicode (BMP of ISO/IEC-10646)<TD><TD><TD>X<TD>X<TD>*
-       <TR><TD>1250<TD>Windows 3.1 Eastern European<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1251<TD>Windows 3.1 Cyrillic<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1252<TD>Windows 3.1 US (ANSI)<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1253<TD>Windows 3.1 Greek<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1254<TD>Windows 3.1 Turkish<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1255<TD>Hebrew<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1256<TD>Arabic<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1257<TD>Baltic<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1361<TD>Korean (Johab)<TD>X<TD><TD><TD>**<TD>X
-         </td>
-       </tr>
-      </tbody>
-      <TBODY>
-       <TR><TD>437<TD>MS-DOS United States<TD><TD>X<TD>X<TD>X<TD>X
-       <TR><TD>708<TD>Arabic (ASMO 708)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>709<TD>Arabic (ASMO 449+, BCON V4)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>710<TD>Arabic (Transparent Arabic)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>720<TD>Arabic (Transparent ASMO)<TD><TD>X<TD><TD><TD>X</td>
-       </tr>
-      </tbody>
-
-    </TABLE>
-
-
-
-
-    <hr>
-    <address><a href="mailto:metaperl@gmail.com">metaperl</a></address>
-<!-- Created: Fri Nov 25 08:48:48 PST 2005 -->
-<!-- hhmts start -->
-Last modified: Fri Nov 25 08:57:41 PST 2005
-<!-- hhmts end -->
-  </body>
-</html>
diff --git a/t/html/table2-tr_ld-default.html b/t/html/table2-tr_ld-default.html
deleted file mode 100644 (file)
index 544553b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <title>Complex HTML Table</title>
-  </head>
-
-  <body style="font-family: Arial, Helvetica, sans-serif" >
-    <h1>Complex HTML Table</h1>
-
-    <P>
-      This table comes from 
-      <a
-       href="http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.5">
-       the w3 spec on tables
-      </a>. I am using it to try out the <code>table2()</code> API call
-      that is part of the new release of 
-      <a
-       href=http://search.cpan.org/search?query=Element%3A%3ALibrary&mode=all>
-       <code>HTML::Element::Library</code>
-      </a>.
-    </p>
-
-    
-    <P>
-
-    <TABLE border="2" frame="hsides" rules="groups"
-      summary="Code page support in different versions
-      of MS Windows.">
-      <CAPTION>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</CAPTION>
-      <COLGROUP align="center">
-      <COLGROUP align="left">
-      <COLGROUP align="center" span="2">
-      <COLGROUP align="center" span="3">
-      <THEAD valign="top">
-       <TR>
-         <TH>Code-Page<BR>ID
-         <TH>Name
-         <TH>ACP
-         <TH>OEMCP
-         <TH>Windows<BR>NT 3.1
-         <TH>Windows<BR>NT 3.51
-         <TH>Windows<BR>95
-         </th>
-       </tr>
-      <TBODY>
-       <TR><TD>1200<TD>Unicode (BMP of ISO/IEC-10646)<TD><TD><TD>X<TD>X<TD>*
-       <TR><TD>1250<TD>Windows 3.1 Eastern European<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1251<TD>Windows 3.1 Cyrillic<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1252<TD>Windows 3.1 US (ANSI)<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1253<TD>Windows 3.1 Greek<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1254<TD>Windows 3.1 Turkish<TD>X<TD><TD>X<TD>X<TD>X
-       <TR><TD>1255<TD>Hebrew<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1256<TD>Arabic<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1257<TD>Baltic<TD>X<TD><TD><TD><TD>X
-       <TR><TD>1361<TD>Korean (Johab)<TD>X<TD><TD><TD>**<TD>X
-         </td>
-       </tr>
-      </tbody>
-      <TBODY>
-       <TR><TD>437<TD>MS-DOS United States<TD><TD>X<TD>X<TD>X<TD>X
-       <TR><TD>708<TD>Arabic (ASMO 708)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>709<TD>Arabic (ASMO 449+, BCON V4)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>710<TD>Arabic (Transparent Arabic)<TD><TD>X<TD><TD><TD>X
-       <TR><TD>720<TD>Arabic (Transparent ASMO)<TD><TD>X<TD><TD><TD>X</td>
-       </tr>
-      </tbody>
-
-    </TABLE>
-
-
-
-
-    <hr>
-    <address><a href="mailto:metaperl@gmail.com">metaperl</a></address>
-<!-- Created: Fri Nov 25 08:48:48 PST 2005 -->
-<!-- hhmts start -->
-Last modified: Fri Nov 25 08:57:41 PST 2005
-<!-- hhmts end -->
-  </body>
-</html>
diff --git a/t/html/table2-tr_ld_coderef.exp b/t/html/table2-tr_ld_coderef.exp
deleted file mode 100644 (file)
index 6df0c73..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-<html>
-  <head>
-    <title>Complex HTML Table</title>
-  </head>
-  <body style="font-family: Arial, Helvetica, sans-serif">
-    <h1>Complex HTML Table</h1>
-    <p> This table comes from <a
-        href="http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.5"> the
-        w3 spec on tables </a>. I am using it to try out the
-      <code>table2()</code> API call that is part of the new release of <a
-        href="http://search.cpan.org/search?query=Element%3A%3ALibrary&amp;mode=all">
-        <code>HTML::Element::Library</code> </a>. </p>
-    <p>
-      <table
-        summary="Code page support in different versions
-      of MS Windows."
-        frame="hsides" rules="groups" border="2">
-        <caption>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</caption>
-        <colgroup align="center"></colgroup>
-        <colgroup align="left"></colgroup>
-        <colgroup align="center" span="2"></colgroup>
-        <colgroup align="center" span="3">
-          <thead valign="top">
-            <tr>
-              <th>Code-Page<br>ID </th>
-              <th>Name </th>
-              <th>ACP </th>
-              <th>OEMCP </th>
-              <th>Windows<br>NT 3.1 </th>
-              <th>Windows<br>NT 3.51 </th>
-              <th>Windows<br>95 </th>
-            </tr>
-            <tbody>
-              <tr>
-                <td>1200</td>
-                <td>Unicode (BMP of ISO/IEC-10646)</td>
-                <td></td>
-                <td></td>
-                <td>X</td>
-                <td>X</td>
-                <td>* </td>
-              </tr>
-              <tr>
-                <td>1255</td>
-                <td>Hebrew</td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>1256</td>
-                <td>Arabic</td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>1257</td>
-                <td>Baltic</td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>1361</td>
-                <td>Korean (Johab)</td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td>**</td>
-                <td>X </td>
-              </tr>
-            </tbody>
-            <tbody>
-              <tr>
-                <td>437</td>
-                <td>MS-DOS United States</td>
-                <td></td>
-                <td>X</td>
-                <td>X</td>
-                <td>X</td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>708</td>
-                <td>Arabic (ASMO 708)</td>
-                <td></td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>709</td>
-                <td>Arabic (ASMO 449+, BCON V4)</td>
-                <td></td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>710</td>
-                <td>Arabic (Transparent Arabic)</td>
-                <td></td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td>X </td>
-              </tr>
-              <tr>
-                <td>720</td>
-                <td>Arabic (Transparent ASMO)</td>
-                <td></td>
-                <td>X</td>
-                <td></td>
-                <td></td>
-                <td>X</td>
-              </tr>
-            </tbody>
-          </thead>
-        </colgroup>
-      </table>
-      <hr>
-      <address><a href="mailto:metaperl@gmail.com">metaperl</a></address>
-      Last modified: Fri Nov 25 08:57:41 PST 2005 </p>
-  </body>
-</html>
index 182abd10020f9c6b9dad3537851471006d32290f..6e86b44bdada1b41c204658cd7d22ec41b5d03a1 100644 (file)
--- a/t/iter.t
+++ b/t/iter.t
@@ -1,23 +1,7 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-my $root = 't/html/iter';
-
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $tree = mktree 't/html/iter.html';
 my $li = $tree->look_down(class => 'store_items');
-
-my @items = qw(bread butter vodka);
-
-$tree->iter($li, @items);
-
-
-is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 
-      "HTML for generated li");
+$tree->iter($li, qw/bread butter vodka/);
+isxml $tree, 't/html/iter.exp', 'iter';
index 8f3f31209ff2d537db5137c06f26dce64140a134..5d4887713784f2d7378c1431d64d0d1d679a70ea 100644 (file)
--- a/t/iter2.t
+++ b/t/iter2.t
@@ -1,43 +1,31 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
+#!/usr/bin/perl
+use t::lib tests => 1;
 
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-my $root = 't/html/iter2';
-
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-my @items = (
-  [    Programmer => 'one who likes Perl and Seamstress', ],
-  [ DBA        => 'one who does business as', ],
-  [ Admin      => 'one who plays Tetris all day' ]
- );
+my $tree = mktree 't/html/iter2.html';
 
 $tree->iter2(
-  # default wrapper_ld ok
-  wrapper_data => \@items,
-  wrapper_proc => sub {
-    my ($container) = @_;
-
-    # only keep the last 2 dts and dds
-    my @content_list = $container->content_list;
-    $container->splice_content(0, @content_list - 2); 
-  },
-  # default item_ld is k00l
-  # default item_data is phrEsh
-  # default item_proc will do w0rk
-  splice       => sub {
-    my ($container, @item_elems) = @_;
-    $container->unshift_content(@item_elems);
-  },
-
-  debug => 1,
- );
-  
-
-is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for generated li");
+       # default wrapper_ld ok
+       wrapper_data => [
+               [ Programmer => 'one who likes Perl and Seamstress' ],
+               [ DBA        => 'one who does business as' ],
+               [ Admin      => 'one who plays Tetris all day' ]
+       ],
+       wrapper_proc => sub {
+               my ($container) = @_;
+
+               # only keep the last 2 dts and dds
+               my @content_list = $container->content_list;
+               $container->splice_content(0, @content_list - 2);
+       },
+       # default item_ld is k00l
+       # default item_data is phrEsh
+       # default item_proc will do w0rk
+       splice       => sub {
+               my ($container, @item_elems) = @_;
+               $container->unshift_content(@item_elems);
+       },
+
+       debug => $ENV{TEST_VERBOSE},
+);
+
+isxml $tree, 't/html/iter2.exp', 'iter2';
diff --git a/t/lib.pm b/t/lib.pm
new file mode 100644 (file)
index 0000000..87704c1
--- /dev/null
+++ b/t/lib.pm
@@ -0,0 +1,36 @@
+package t::lib;
+use strict;
+use warnings;
+
+use File::Slurp qw/read_file/;
+use HTML::TreeBuilder;
+use HTML::Element::Library;
+use Test::More ();
+use Test::XML;
+
+use parent qw/Exporter/;
+our @EXPORT = qw/is is_deeply is_xml slurp mktree isxml/;
+our $VERSION = '0.001'; # Exporter needs a $VERSION
+
+sub import {
+       my ($self, @args) = @_;
+       strict->import;
+       warnings->import;
+       Test::More->import(@args);
+
+       $self->export_to_level(1, $self);
+}
+
+sub slurp { scalar read_file @_ }
+
+sub mktree {
+       my ($file) = @_;
+       HTML::TreeBuilder->new_from_file($file)->disembowel;
+}
+
+sub isxml {
+       my ($tree, $file, $name) = @_;
+       my $res = ref $tree eq 'SCALAR' ? $$tree : $tree->as_XML;
+       my $exp = ref $file eq 'SCALAR' ? $$file : slurp $file;
+       is_xml $res, $exp, $name
+}
index 43b641deeb61f1a9cede496c32037243961e9497..edeff5e43c3308d959a93928d48472e397cb08cd 100644 (file)
@@ -1,51 +1,10 @@
 #!/usr/bin/perl -T
+use lib '.';
+use t::lib tests => 1;
 
+my @list = map { [item => $_] } qw/bread butter beans/;
+my $initial_lol = [ note => [ list => [ item => 'sample' ] ] ];
+my ($new_lol) = HTML::Element::newchild($initial_lol, list => @list);
 
-use warnings;
-use strict;
-
-use Test::More;
-use Test::XML;
-
-BEGIN {
-    use_ok('HTML::TreeBuilder');
-    use_ok('HTML::Element::Library');
-}
-
-
-my $initial_lol = [ note => [ shopping => [ item => 'sample' ] ] ];
-my $new_lol = HTML::Element::newchild($initial_lol, shopping => shopping_items());
-
-
-sub shopping_items {
-  my @shopping_items = map { [ item => $_ ] } qw(bread butter beans);
-  @shopping_items;
-}
-
-my $expected =  [
-          'note',
-          [
-            'shopping',
-              [
-                'item',
-                'bread'
-              ],
-              [
-                'item',
-                'butter'
-              ],
-              [
-                'item',
-                'beans'
-              ]
-          ]
-        ];
-
-use Data::Dumper;
-warn Dumper($new_lol);
-
-is_deeply($new_lol, $expected, 'test unrolling');
-
-
-
-done_testing;
+my $expected = [note => [list => [item => 'bread'], [item => 'butter'], [item => 'beans']]];
+Test::More::is_deeply($new_lol, $expected, 'test unrolling');
index 09951ab7bbfa0ee41b3dd152d0cc43d577331e93..2a0a9012fa3f6110f21b6ea58231898731682ab2 100644 (file)
@@ -1,32 +1,6 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
-sub replace_age { 
-  my $branch = shift;
-  my $age = shift;
-  $branch->look_down(id => 'age')->replace_content($age);
-}
-
-
-sub tage {
-  my $age = shift;
-
-  my $tree = HTML::TreeBuilder->new_from_file('t/html/highlander2.html');
-
-  my $saved_child = $tree->passover('under18');
-
-  my $root = "t/html/highlander2-passover";
-
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for $age");
-}
-
-
-tage('666');
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $tree = mktree 't/html/highlander2.html';
+$tree->passover('under18');
+isxml $tree, 't/html/highlander2-passover.exp', 'passover';
index b48463defd99ea70cf016a55e0bd59bfe250c51b..93dbfb5897ec0bea74c1e0bb23718adf6959493e 100644 (file)
@@ -1,8 +1,5 @@
-use strict;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
+#!/usr/bin/perl
+use t::lib tests => 1;
 
 my $html =<<'EOHTML';
 <html>
@@ -21,17 +18,8 @@ my $html =<<'EOHTML';
 </html>
 EOHTML
 
-my $t1;
-my $lol;
-
-$t1 = HTML::TreeBuilder->new_from_content ( $html ) ;
-
-my $found= $t1->look_down(id => 'findme');
-
-
-my @found = $found->position;
-#warn "@found";
-
-is("@found", '-1 1 0 1 2');
-
+my $t1 = HTML::TreeBuilder->new_from_content ($html) ;
+my $found = $t1->look_down(id => 'findme');
 
+my $pos = join ' ', $found->position;
+is $pos, '-1 1 0 1 2';
index af343dbde03d96b9285610f6345d6c0c166897cd..654e6561d4540015ecdc7bb3b9da380400fb3629 100644 (file)
--- a/t/prune.t
+++ b/t/prune.t
@@ -1,22 +1,9 @@
 #!/usr/bin/perl -T
+use lib '.';
+use t::lib tests => 1;
 
-
-use warnings;
-use strict;
-
-use Test::More;
-use Test::XML;
-
-BEGIN {
-    use_ok('HTML::TreeBuilder');
-    use_ok('HTML::Element::Library');
-}
-
-
-
-my $root = HTML::TreeBuilder->new();
-my $html =<<'EOHTML';
-<html>    
+my $root = HTML::TreeBuilder->new_from_content(<<'EOHTML');
+<html>
 <head>
   <title></title>
 </head>
@@ -31,8 +18,6 @@ my $html =<<'EOHTML';
 </html>
 EOHTML
 
-$root->parse($html);
-$root->delete_ignorable_whitespace;
 $root->prune;
 
 my $expected = '
@@ -42,10 +27,4 @@ my $expected = '
 </html>
 ';
 
-#warn sprintf 'HTML:%s:HTML', $root->as_HTML;
-
-is_xml($root->as_HTML, $expected, 'test pruning');
-
-
-
-done_testing;
+isxml($root, \$expected, 'prune');
index 40b0b7e0af1854d0486752313fe3726f70c93158..4723593d3efc4ab021173060e015eab44b44a7fa 100644 (file)
@@ -1,32 +1,16 @@
-use strict;
-use Test::More qw(no_plan);
-
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body',
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 'um, p < 4!', {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
+#!/usr/bin/perl
+use t::lib tests => 1;
 
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', 'um, p < 4!', {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
 $t1->look_down('_tag' => 'body')->replace_content('all gone!');
-is( $t1->as_HTML, '<html><head><title>I like stuff!</title></head><body lang="en-JP">all gone!</body></html>', "replaced all of body");
-
 
+isxml $t1, \'<html><head><title>I like stuff!</title></head><body id="corpus" lang="en-JP">all gone!</body></html>', 'replace_content';
index 231ce7adecea04fafae9a5c19b055c7bb5864683..ce8a18c89cbe86da96c4dda92003217809c93e84 100644 (file)
@@ -1,33 +1,15 @@
-use strict;
-use Test::More qw(no_plan);
+#!/usr/bin/perl
+use t::lib tests => 1;
+
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', 'um, p < 4!', {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body', {id => 'corpus'},
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 'um, p < 4!', {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
-
-
-#$t1->look_down('_tag' => 'body')->replace_content('all gone!');
 $t1->set_child_content(id => 'corpus', 'all gone!');
-is( $t1->as_HTML, '<html><head><title>I like stuff!</title></head><body id="corpus" lang="en-JP">all gone!</body></html>', "replaced all of body");
-
-
+isxml $t1, \'<html><head><title>I like stuff!</title></head><body id="corpus" lang="en-JP">all gone!</body></html>', 'set_child_content';
index 7c959f5d8457d4aea81965f5e642750e5a089a77..1181e06cd3ea1e6b096744f5723347d0340f4f3f 100644 (file)
@@ -1,32 +1,15 @@
-use strict;
-use Test::More qw(no_plan);
-
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body',
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 'um, p < 4!', {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
+#!/usr/bin/perl
+use t::lib tests => 1;
+
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', 'um, p < 4!', {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
 my $p = $t1->look_down('_tag' => 'body')->look_down(_tag => 'p');
-
-is($p->sibdex, 1, "does the p tag have 1 as its index");
-
-
+is $p->sibdex, 1, 'p tag has 1 as its index';
index d1e753ec8be31acbcbbff16936237557f5cf6514..50b8c2f5469f597b6fdd22a174726531bde5b5b4 100644 (file)
@@ -1,40 +1,19 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl HTML-Element-Library.t'
-
-
-
-
-use strict;
-use Test::More qw(no_plan);
-
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body',
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 'um, p < 4!', {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
+#!/usr/bin/perl
+use t::lib tests => 3;
+
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', 'um, p < 4!', {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
 my $div = $t1->look_down('_tag' => 'body')->look_down(_tag => 'p');
 my @sibs = $div->siblings;
 
-is($sibs[0], 'stuff', "first sibling is simple text");
-is($sibs[2]->tag, 'div', "3rd tag a div tag");
-is(scalar @sibs, 4, "4 siblings total");
-
+is $sibs[0], 'stuff', "first sibling is simple text";
+is $sibs[2]->tag, 'div', "3rd tag is a div tag";
+is scalar @sibs, 4, "4 siblings total";
index 9b840795926c9b41b9c69ccfed5feae41ec2d199..f759da4dc9a3ef00f68be584eb95c67f9d5ea81e 100644 (file)
@@ -1,54 +1,22 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
+#!/usr/bin/perl
+use t::lib tests => 1;
+use lib 't';
 use SimpleClass;
 
-my $root = 't/html/table-alt';
 my $o    = SimpleClass->new;
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-
-$tree->table
- (
-    # tell seamstress where to find the table, via the method call
-    # ->look_down('id', $gi_table). Seamstress detaches the table from the
-    # HTML tree automatically if no table rows can be built
-      gi_table    => 'load_data',
-    # tell seamstress where to find the tr. This is a bit useless as
-    # the <tr> usually can be found as the first child of the parent
-      gi_tr       => ['iterate1', 'iterate2'],
-      
-    # the model data to be pushed into the table
-      table_data  => $o->load_data,
-    # the way to take the model data and obtain one row
-    # if the table data were a hashref, we would do:
-    # my $key = (keys %$data)[0]; my $val = $data->{$key}; delete $data->{$key}
-      tr_data     => sub { my ($self, $data) = @_;
-                          shift(@{$data}) ;
-                        },
-    # the way to take a row of data and fill the <td> tags
-      td_data     => sub { my ($tr_node, $tr_data) = @_;
-                          $tr_node->content_handler($_ => $tr_data->{$_})
-                            for qw(name age weight) }
-   );
-
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 
-      "HTML for non-alternating table");
+my $tree = mktree 't/html/table-alt.html';
+
+$tree->table(
+       gi_table    => 'load_data',
+       gi_tr       => ['iterate1', 'iterate2'],
+       table_data  => $o->load_data,
+       tr_data     => sub {
+               my ($self, $data) = @_;
+               shift @{$data};
+       },
+       td_data     => sub {
+               my ($tr_node, $tr_data) = @_;
+               $tr_node->content_handler($_ => $tr_data->{$_}) for qw(name age weight)
+       });
+
+isxml $tree, 't/html/table-alt.exp', 'table (alternating)';
index 23510387575f9d692788e6b1bec19ee35425df5b..fe9fbf42ac276340bdc90422e030489c8c6864ef 100644 (file)
--- a/t/table.t
+++ b/t/table.t
@@ -1,54 +1,22 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
+#!/usr/bin/perl
+use t::lib tests => 1;
+use lib 't';
 use SimpleClass;
 
-my $root = 't/html/table';
 my $o    = SimpleClass->new;
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-
-$tree->table
- (
-    # tell seamstress where to find the table, via the method call
-    # ->look_down('id', $gi_table). Seamstress detaches the table from the
-    # HTML tree automatically if no table rows can be built
-      gi_table    => 'load_data',
-    # tell seamstress where to find the tr. This is a bit useless as
-    # the <tr> usually can be found as the first child of the parent
-      gi_tr       => 'data_row',
-      
-    # the model data to be pushed into the table
-      table_data  => $o->load_data,
-    # the way to take the model data and obtain one row
-    # if the table data were a hashref, we would do:
-    # my $key = (keys %$data)[0]; my $val = $data->{$key}; delete $data->{$key}
-      tr_data     => sub { my ($self, $data) = @_;
-                          shift(@{$data}) ;
-                        },
-    # the way to take a row of data and fill the <td> tags
-      td_data     => sub { my ($tr_node, $tr_data) = @_;
-                          $tr_node->content_handler($_ => $tr_data->{$_})
-                            for qw(name age weight) }
-   );
-
-  is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 
-      "HTML for non-alternating table");
+my $tree = mktree 't/html/table.html';
+
+$tree->table(
+       gi_table    => 'load_data',
+       gi_tr       => 'data_row',
+       table_data  => $o->load_data,
+       tr_data     => sub { 
+               my ($self, $data) = @_;
+               shift(@{$data}) ;
+       },
+       td_data     => sub {
+               my ($tr_node, $tr_data) = @_;
+               $tr_node->content_handler($_ => $tr_data->{$_}) for qw(name age weight)
+       });
+
+isxml $tree, 't/html/table.exp', 'table';
index c53735a8bf93ea5b7f306c73f819e7285ec9a7eb..1a359daff1a8b3dd54d86e2649140589330afc7e 100644 (file)
@@ -1,65 +1,43 @@
-# This might look like shell script, but it's actually -*- perl -*-
+#!/usr/bin/perl
 # Test the 3 possible look_down calls to table2()
 #   a = default
 #   b = supplied array ref
 #   c = supplied code ref
-
-use strict;
+use t::lib tests => 3;
 use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More;
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
 use data::table2;
 
-
 my $o    = data::table2->new;
 
 # a - default table_ld
 
-my $root = 't/html/table2';
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
+my $tree = mktree 't/html/table2.html';
 
 my $table = HTML::Element::Library::ref_or_ld(
-  $tree,
-  ['_tag' => 'table']
- );
+       $tree,
+       ['_tag' => 'table']
+);
 
-is_xml ($table->as_XML, scalar File::Slurp::read_file("$root-table_ld.exp"), $root);
+isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down default';
 
 # b - arrayref table_ld
 
-$tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-
 $table = HTML::Element::Library::ref_or_ld(
-  $tree,
-  [frame => 'hsides', rules => 'groups']
+       $tree,
+       [frame => 'hsides', rules => 'groups']
  );
 
-is_xml ($table->as_XML, scalar File::Slurp::read_file("$root-table_ld.exp"), $root);
+isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down arrayref';
 
 # c - coderef table_ld
 
-$tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-
 $table = HTML::Element::Library::ref_or_ld(
-  $tree,
-  sub {
-    my ($t) = @_;
-    my $caption = $t->look_down('_tag' => 'caption');
-    $caption->parent;
-  }
- );
-
-is_xml ($table->as_XML, scalar File::Slurp::read_file("$root-table_ld.exp"), $root);
-
-
-done_testing;
+       $tree,
+       sub {
+               my ($t) = @_;
+               my $caption = $t->look_down('_tag' => 'caption');
+               $caption->parent;
+       }
+);
+
+isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down coderef';
index 6e01c51bce21f5761559b8b43603d3ad447621a2..c6852056639646e51deec7988123dd45c6932b61 100644 (file)
@@ -1,82 +1,54 @@
-# This might look like shell script, but it's actually -*- perl -*-
-# Test the 3 possible look_down calls to table2()
-#   a = default
-#   b = supplied array ref
-#   c = supplied code ref
-
-use strict;
-use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Scalar::Listify;
-use Test::XML;
-
-use data::table2;
-
-
-my $o    = data::table2->new;
+#!/usr/bin/perl
+use t::lib tests => 3;
 
 # a - default table_ld
 
-my $root = 't/html/table2';
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
+my $tree = mktree 't/html/table2.html';
 
 my @tr = HTML::Element::Library::ref_or_ld(
-  $tree,
-  ['_tag' => 'tr']
- );
+       $tree,
+       ['_tag' => 'tr']
+);
 
-is (scalar @tr, 16, 'default ld_tr');
+is (scalar @tr, 16, 'table2 tr look_down (default)');
 
 # b - arrayref tr_ld
 
-$root = 't/html/table2-tr_ld-arrayref';
-$tree = HTML::TreeBuilder->new_from_file("$root.html");
-
+$tree = mktree 't/html/table2-tr_ld-arrayref.html';
 
 my $tr = HTML::Element::Library::ref_or_ld(
-  $tree,
-  [class => 'findMe']
- );
+       $tree,
+       [class => 'findMe']
+);
 
-is_xml ($tr->as_XML, scalar File::Slurp::read_file("$root.exp"), $root);
+isxml $tr, 't/html/table2-tr_ld-arrayref.exp', 'table2 tr look_down (arrayref)';
 
 # c - coderef tr_ld
 # removes windows listings before returning @tr
 
-$root = 't/html/table2';
-$tree = HTML::TreeBuilder->new_from_file("$root.html");
-
+$tree = mktree 't/html/table2.html';
 
 @tr = HTML::Element::Library::ref_or_ld(
-  $tree,
-  sub {
-    my ($t) = @_;
-    my @tr = $t->look_down('_tag' => 'tr');
-    my @keep;
-    for my $tr (@tr) {
-
-      my @td = $tr->look_down ('_tag' => 'td') ;
-      my $detached;
-      for my $td (@td) {
-       if (grep { $_ =~ /Windows/ } $td->content_list) {
-         $tr->detach();
-         ++$detached;
-         last;
+       $tree,
+       sub {
+               my ($t) = @_;
+               my @tr = $t->look_down('_tag' => 'tr');
+               my @keep;
+               for my $tr (@tr) {
+
+                       my @td = $tr->look_down ('_tag' => 'td') ;
+                       my $detached;
+                       for my $td (@td) {
+                               if (grep { $_ =~ /Windows/ } $td->content_list) {
+                                       $tr->detach;
+                                       ++$detached;
+                                       last;
+                               }
+                       }
+                       push @keep, $tr unless $detached;
+               }
+               @keep;
        }
-      }
-      push @keep, $tr unless $detached;
-    }
-    @keep;
-  }
- );
-
-#warn $_->as_HTML, $/ for @tr;
+);
 
-is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root-tr_ld-coderef.exp"), $root);
+isxml $tree, 't/html/table2-tr_ld-coderef.exp', 'table2 tr look_down (coderef)';
index f72096e71a768118d15ecbd806f53d02250cf7db..3566c63da5eafba825f7eb455ae9f1245418daa6 100644 (file)
@@ -1,52 +1,34 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More;
-use Test::XML;
-
-use Data::Dumper;
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
-
+#!/usr/bin/perl
+use t::lib tests => 1;
+use lib 't';
 use data::table2;
 
 my $root = 't/html/table2';
-my $o    = data::table2->new;
 my $d    = data::table2->load_data;
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
-#warn 'D:', Dumper $d;
+my $tree = mktree 't/html/table2.html';
 
 for my $dataset (keys %$d) {
-  my %tbody = ('4dig' => 0, '3dig' => 1);
-  $tree->table2 (
-#    debug => 1,
-    table_data => $d->{$dataset},
-    tr_base_id => $dataset,
-    tr_ld => sub {
-      my $t = shift;
-      my $tbody = ($t->look_down('_tag' => 'tbody'))[$tbody{$dataset}];
-      my @tbody_child = $tbody->content_list;
-      $tbody_child[$_]->detach for (1 .. $#tbody_child) ;
-      $tbody->content_list;
-    },
-    td_proc => sub {
-      my ($tr, $data) = @_;
-      my @td = $tr->look_down('_tag' => 'td');
-      for my $i (0..$#td) {
-#      warn $i;
-       $td[$i]->splice_content(0, 1, $data->[$i]);
-      }
-    }
-   );
+       my %tbody = ('4dig' => 0, '3dig' => 1);
+       $tree->table2 (
+               debug => $ENV{TEST_VERBOSE},
+               table_data => $d->{$dataset},
+               tr_base_id => $dataset,
+               tr_ld => sub {
+                       my $t = shift;
+                       my $tbody = ($t->look_down('_tag' => 'tbody'))[$tbody{$dataset}];
+                       my @tbody_child = $tbody->content_list;
+                       $tbody_child[$_]->detach for (1 .. $#tbody_child) ;
+                       $tbody->content_list;
+               },
+               td_proc => sub {
+                       my ($tr, $data) = @_;
+                       my @td = $tr->look_down('_tag' => 'td');
+                       for my $i (0..$#td) {
+                               #       warn $i;
+                               $td[$i]->splice_content(0, 1, $data->[$i]);
+                       }
+               }
+       );
 }
 
-
-is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 'genhtml');
-
-
-done_testing;
+isxml $tree, 't/html/table2.exp', 'table2';
index a21c712fbe05d9cbd715e683a3c75301ce2c68dd..d29870a014415e097089fc2fe51ad2619849ebf8 100644 (file)
@@ -1,31 +1,17 @@
-# This might look like shell script, but it's actually -*- perl -*-
-use strict;
-use lib qw(t/ t/m/);
-
-
-use File::Slurp;
-use Test::More qw(no_plan);
-
-use HTML::TreeBuilder;
-use HTML::Element::Library;
-use Test::XML;
+#!/usr/bin/perl
+use t::lib tests => 1;
+use lib 't';
 
 use SelectData;
 
-my $root = 't/html/unroll_select';
-
-my $tree = HTML::TreeBuilder->new_from_file("$root.html");
-
+my $tree = mktree 't/html/unroll_select.html';
 
-$tree->unroll_select
- (
-   select_label     => 'clan_list', 
-   option_value     => sub { my $row = shift; $row->{clan_id} },
-   option_content   => sub { my $row = shift; $row->{clan_name} },
-   option_selected  => sub { my $row = shift; $row->{selected} },
-   data             => SelectData->load_data,
-   data_iter        => sub { my $data = shift; shift @$data }
-  );
+$tree->unroll_select(
+       select_label     => 'clan_list',
+       option_value     => sub { my $row = shift; $row->{clan_id} },
+       option_content   => sub { my $row = shift; $row->{clan_name} },
+       option_selected  => sub { my $row = shift; $row->{selected} },
+       data             => SelectData->load_data,
+       data_iter        => sub { my $data = shift; shift @$data });
 
-is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), 
-      "HTML for non-alternating table");
+isxml ($tree, 't/html/unroll_select.exp', 'unroll_select');
index 976420e2047f64180e9551c50892d709ff870185..7c766bcde64a4c98bdfa30b89f9d58cc582274bc 100644 (file)
@@ -1,38 +1,18 @@
-use strict;
-use Test::More qw(no_plan);
+#!/usr/bin/perl
+use t::lib tests => 1;
 
-use HTML::Element::Library;
-
-
-my $t1;
-my $lol;
-$t1 = HTML::Element->new_from_lol
-  (
-   $lol =
-   ['html',
-    ['head',
-     [ 'title', 'I like stuff!' ],
-    ],
-    ['body',
-     {
-      'lang', 'en-JP'},
-     'stuff',
-     ['p', 
-      ['span', {id => 'wrapme'},
-      'um, p < 4!', 
-       ],
-      {'class' => 'par123'}],
-     ['div', {foo => 'bar'}, '123'], # at 0.1.2
-     ['div', {jack => 'olantern'}, '456'], # at 0.1.2
-    ]
-   ]
-  )
-  ;
+my $t1 = HTML::Element->new_from_lol(
+       ['html',
+        ['head',
+         [ 'title', 'I like stuff!' ]],
+        ['body', {id => 'corpus'}, {'lang', 'en-JP'},
+         'stuff',
+         ['p', ['span', {id => 'wrapme'}, 'um, p < 4!'], {'class' => 'par123'}],
+         ['div', {foo => 'bar'}, '123'], # at 0.1.2
+         ['div', {jack => 'olantern'}, '456']]]); # at 0.1.2
 
 my $bold = HTML::Element->new('b', id => 'wrapper');
 
-my $W = $t1->look_down('id' => 'wrapme');
-$W->wrap_content($bold);
-is( $W->as_HTML, '<span id="wrapme"><b id="wrapper">um, p &lt; 4!</b></span>', "wrapped text");
-
-
+my $w = $t1->look_down('id' => 'wrapme');
+$w->wrap_content($bold);
+isxml $w, \'<span id="wrapme"><b id="wrapper">um, p &lt; 4!</b></span>', 'wrap_content';
This page took 0.064659 seconds and 4 git commands to generate.