]> iEval git - html-element-library.git/blobdiff - t/newnode.t
all tests pass
[html-element-library.git] / t / newnode.t
diff --git a/t/newnode.t b/t/newnode.t
new file mode 100644 (file)
index 0000000..5ca7122
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -T
+
+
+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::newnode($initial_lol, item => 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'
+              ]
+            ]
+          ]
+        ];
+
+is_deeply($new_lol, $expected, 'test unrolling');
+
+
+
+done_testing;
This page took 0.017416 seconds and 4 git commands to generate.