annotate _test/Test/DOM/Node.pm @ 14:65a7bb156fb7

Дом модель и схема
author Sergey
date Fri, 04 Sep 2009 16:38:15 +0400
parents
children 818c74b038ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
1 package Test::DOM::Node;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
2 use strict;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
3 use warnings;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
4
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
5 use base qw(IMPL::Test::Unit);
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
6 use IMPL::Test qw(test shared failed);
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
7 use IMPL::Class::Property;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
8
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
9 require IMPL::DOM::Node;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
10
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
11 __PACKAGE__->PassThroughArgs;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
12
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
13 BEGIN {
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
14 shared public property Root => prop_all;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
15 }
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
16
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
17 test Create => sub {
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
18 my ($this) = @_;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
19
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
20 $this->Root(new IMPL::DOM::Node(nodeName => 'Root')) or failed "Failed to create a node";
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
21 };
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
22
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
23 test AppendNode => sub {
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
24 my ($this) = @_;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
25
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
26 my $child = $this->Root->appendNode(new IMPL::DOM::Node(nodeName => 'Child')) or failed "Failed to append a child node";
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
27
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
28 my $firstChild = $this->Root->firstChild;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
29
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
30 failed "firstChild returned incorrect results" unless $firstChild == $child;
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
31 };
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
32
65a7bb156fb7 Дом модель и схема
Sergey
parents:
diff changeset
33 1;