]> iEval git - html-element-library.git/blame - t/newnode.t
all tests pass
[html-element-library.git] / t / newnode.t
CommitLineData
271d5078
TB
1#!/usr/bin/perl -T
2
3
4use warnings;
5use strict;
6
7use Test::More;
8use Test::XML;
9
10BEGIN {
11 use_ok('HTML::TreeBuilder');
12 use_ok('HTML::Element::Library');
13}
14
15
16my $initial_lol = [ note => [ shopping => [ item => 'sample' ] ] ];
17my $new_lol = HTML::Element::newnode($initial_lol, item => shopping_items());
18
19
20sub shopping_items {
21 my @shopping_items = map { [ item => $_ ] } qw(bread butter beans);
22 \@shopping_items;
23}
24
25my $expected = [
26 'note',
27 [
28 'shopping',
29 [
30 [
31 'item',
32 'bread'
33 ],
34 [
35 'item',
36 'butter'
37 ],
38 [
39 'item',
40 'beans'
41 ]
42 ]
43 ]
44 ];
45
46is_deeply($new_lol, $expected, 'test unrolling');
47
48
49
50done_testing;
This page took 0.026655 seconds and 4 git commands to generate.