File: package.t

package info (click to toggle)
libxml-libxml-lazybuilder-perl 0.08-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 100 kB
  • sloc: perl: 194; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- perl -*-
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl XML-LibXML-LazyBuilder.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 3;

#########################

# 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.

use XML::LibXML::LazyBuilder; # do not import

sub E {}
sub DOM {}

{
    package XML::LibXML::LazyBuilder;
    my $d = DOM (E A => {at1 => "val1", at2 => "val2", E => "EEE!"},
		 ((E B => {}, ((E "C"),
			       (E "D"))),
		  (E E => {}, ((E "F"),
			       (E "G")))));

    package main;
    is ($d->firstChild->firstChild->nextSibling->firstChild->nextSibling->tagName,
	"G", "package");
    is ($d->firstChild->getAttribute ("E"), "EEE!", "package");
}

{
    package XML::LibXML::LazyBuilder;
    my $d = DOM (E A => {at2 => "val1", at1 => "val2"},
		 ((E B => {}, ((E "C"),
			       (E D => {}, "Content of D"))),
		  (E E => {}, ((E F => {}, "Content of F"),
			       (E "G")))));

    package main;
    is ($d->toStringC14N,
        (qq[<A at1="val2" at2="val1"><B><C></C><D>Content of D</D></B>]
         . qq[<E><F>Content of F</F><G></G></E></A>]), "example");
}