comparison _test/Test/DOM/Node.pm @ 148:e6447ad85cb4

DOM objects now have a schema and schemaSource properties RegExp now can launder data Improved post to DOM transformation (multiple values a now supported) Added new axes to navigation queries: ancestor and descendant minor changes and bug fixes
author wizard
date Mon, 16 Aug 2010 08:26:44 +0400
parents e30bdd040fe3
children 4267a2ac3d46
comparison
equal deleted inserted replaced
147:c2aa10fbb396 148:e6447ad85cb4
38 38
39 test GetDocumentNode => sub { 39 test GetDocumentNode => sub {
40 my ($this) = @_; 40 my ($this) = @_;
41 41
42 my $child = $this->Root->firstChild->appendNode(new IMPL::DOM::Node(nodeName => 'GrandChild')) or failed "Failed to append a child node"; 42 my $child = $this->Root->firstChild->appendNode(new IMPL::DOM::Node(nodeName => 'GrandChild')) or failed "Failed to append a child node";
43
44 failed "document property is undef" unless $child->document;
45 failed "document property returned incorrect value" unless $child->document == $this->Root;
46 };
47
48 test DocumentCreateNode => sub {
49 my ($this) = @_;
50
51 my $child = $this->Root->firstChild->appendNode($this->Root->Create(Info => { uuid => '77f9-9a-6d58' } )) or failed "Failed to append a child node";
43 52
44 failed "document property is undef" unless $child->document; 53 failed "document property is undef" unless $child->document;
45 failed "document property returned incorrect value" unless $child->document == $this->Root; 54 failed "document property returned incorrect value" unless $child->document == $this->Root;
46 }; 55 };
47 56
92 "Expected: 2", 101 "Expected: 2",
93 "Actual: ".scalar(@result) 102 "Actual: ".scalar(@result)
94 unless @result == 2; 103 unless @result == 2;
95 }; 104 };
96 105
106 test SelectNodesPath => sub {
107 my ($this) = @_;
108
109 my @result = $this->Root->selectNodes('Child','Info');
110
111 failed "Failed to select a node by path 'Child/Info'" unless @result;
112 };
113
114 test SelectByAxisDescendant => sub {
115 my ($this) = @_;
116
117 my @result = $this->Root->selectNodes( { descendant => ['GrandChild','Info']} );
118
119 failed "Failed to select a node by path '//(GrandChild|Info)/'" unless @result == 2;
120 };
121
122 test SelectByAxisAncestor => sub {
123 my ($this) = @_;
124
125 my @result = $this->Root->selectSingleNode( { descendant => 'Info'} )->selectNodes( { ancestor => undef } ) ;
126
127 failed "Failed to select a node by path '//Info/ancestor:*'" unless @result == 2;
128 };
129
97 test CheckNodesValues => sub { 130 test CheckNodesValues => sub {
98 my ($this) = @_; 131 my ($this) = @_;
99 132
100 my @expected = (1..10); 133 my @expected = (1..10);
101 134
116 149
117 test isComplex => sub { 150 test isComplex => sub {
118 my ($this) = @_; 151 my ($this) = @_;
119 152
120 failed "property isComplex returned false for the root node" unless $this->Root->isComplex; 153 failed "property isComplex returned false for the root node" unless $this->Root->isComplex;
121 failed "property isComplex returned true for a simple node", $this->Root->firstChild->nodeName if $this->Root->firstChild->isComplex; 154 failed "property isComplex returned true for a simple node", $this->Root->selectSingleNode('Item')->childNodes->Count if $this->Root->selectSingleNode('Item')->isComplex;
122 }; 155 };
123 156
124 test setObjectProperty => sub { 157 test setObjectProperty => sub {
125 my ($this) = @_; 158 my ($this) = @_;
126 159