Mercurial > pub > Impl
comparison _test/Test/DOM/Node.pm @ 123:1d7e370a91fa
Additional DOM::Node tests
author | wizard |
---|---|
date | Wed, 09 Jun 2010 17:53:12 +0400 |
parents | a7efb3117295 |
children | e30bdd040fe3 |
comparison
equal
deleted
inserted
replaced
122:a7efb3117295 | 123:1d7e370a91fa |
---|---|
119 | 119 |
120 failed "property isComplex returned false for the root node" unless $this->Root->isComplex; | 120 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; | 121 failed "property isComplex returned true for a simple node", $this->Root->firstChild->nodeName if $this->Root->firstChild->isComplex; |
122 }; | 122 }; |
123 | 123 |
124 test setObjectProperty => sub { | |
125 my ($this) = @_; | |
126 | |
127 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode'); | |
128 | |
129 my $name = 'Vergon 6'; | |
130 | |
131 $node->nodeProperty(name => $name); | |
132 failed "Failed to set a property 'name'", "Expected: $name", "Got: ".$node->name unless $node->name eq $name; | |
133 | |
134 $name = 'entity_vergon_6'; | |
135 $node->systemName($name); | |
136 failed "Failed to set a property 'systemName'", "Expected: $name", "Got: ".$node->nodeProperty('systemName') unless $node->nodeProperty('systemName') eq $name; | |
137 }; | |
138 | |
139 test setDynamicProperty => sub { | |
140 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode'); | |
141 | |
142 my $uuid = 'entity_76fd98b9e7a'; | |
143 $node->nodeProperty(uuid => $uuid); | |
144 failed "Failed to set a dynamic property 'uuid'", "Expected: $uuid", "Got: ".$node->nodeProperty('uuid') unless $node->nodeProperty('uuid') eq $uuid; | |
145 }; | |
146 | |
147 test setPrivateProperty => sub { | |
148 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode'); | |
149 | |
150 eval { | |
151 $node->nodeProperty(_private => 'failed'); | |
152 1; | |
153 } and failed "Setting a private property successfull"; | |
154 }; | |
155 | |
124 package Test::DOM::TypedNode; | 156 package Test::DOM::TypedNode; |
125 use base qw(IMPL::DOM::Node); | 157 use base qw(IMPL::DOM::Node); |
126 use IMPL::Class::Property; | 158 use IMPL::Class::Property; |
127 use IMPL::DOM::Property; | 159 use IMPL::DOM::Property qw(_dom); |
128 | 160 |
161 __PACKAGE__->PassThroughArgs; | |
162 | |
163 BEGIN { | |
164 public _dom property name => prop_all; | |
165 public property systemName => prop_all; | |
166 private _dom property _private => prop_all; | |
167 } | |
129 | 168 |
130 | 169 |
131 1; | 170 1; |