]> iEval git - html-element-library.git/blobdiff - t/newchild.t
Refactor tests (first pass)
[html-element-library.git] / t / newchild.t
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');
This page took 0.021957 seconds and 4 git commands to generate.