diff _test/Test/DOM/Node.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 029c9610528c
children 99ac2e19c0cc
line wrap: on
line diff
--- a/_test/Test/DOM/Node.pm	Tue Apr 10 08:13:22 2012 +0400
+++ b/_test/Test/DOM/Node.pm	Tue Apr 10 20:08:29 2012 +0400
@@ -47,9 +47,9 @@
 };
 
 test DocumentCreateNode => sub {
-	my ($this) = @_;
-	
-	my $child = $this->Root->firstChild->appendNode($this->Root->Create(Info => { uuid => '77f9-9a-6d58' } )) or failed "Failed to append a child node";
+    my ($this) = @_;
+    
+    my $child = $this->Root->firstChild->appendNode($this->Root->Create(Info => { uuid => '77f9-9a-6d58' } )) or failed "Failed to append a child node";
     
     failed "document property is undef" unless $child->document;
     failed "document property returned incorrect value" unless $child->document == $this->Root;
@@ -105,27 +105,27 @@
 };
 
 test SelectNodesPath => sub {
-	my ($this) = @_;
-	
-	my @result = $this->Root->selectNodes('Child','Info');
-	
-	failed "Failed to select a node by path 'Child/Info'" unless @result;
+    my ($this) = @_;
+    
+    my @result = $this->Root->selectNodes('Child','Info');
+    
+    failed "Failed to select a node by path 'Child/Info'" unless @result;
 };
 
 test SelectByAxisDescendant => sub {
-	my ($this) = @_;
-	
-	my @result = $this->Root->selectNodes( { descendant => ['GrandChild','Info']} );
-	
-	failed "Failed to select a node by path '//(GrandChild|Info)/'" unless @result == 2;
+    my ($this) = @_;
+    
+    my @result = $this->Root->selectNodes( { descendant => ['GrandChild','Info']} );
+    
+    failed "Failed to select a node by path '//(GrandChild|Info)/'" unless @result == 2;
 };
 
 test SelectByAxisAncestor => sub {
-	my ($this) = @_;
-	
-	my @result = $this->Root->selectSingleNode( { descendant => 'Info'} )->selectNodes( { ancestor => undef } ) ;
-	
-	failed "Failed to select a node by path '//Info/ancestor:*'" unless @result == 2;
+    my ($this) = @_;
+    
+    my @result = $this->Root->selectSingleNode( { descendant => 'Info'} )->selectNodes( { ancestor => undef } ) ;
+    
+    failed "Failed to select a node by path '//Info/ancestor:*'" unless @result == 2;
 };
 
 test CheckNodesValues => sub {
@@ -156,82 +156,82 @@
 };
 
 test setObjectProperty => sub {
-	my ($this) = @_;
-	
-	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
-	
-	my $name = 'Vergon 6';
-	
-	$node->nodeProperty(name => $name);
-	failed "Failed to set a property 'name'", "Expected: $name", "Got: ".$node->name unless $node->name eq $name;
-	
-	$name = 'entity_vergon_6';
-	$node->systemName($name);
-	failed "Failed to set a property 'systemName'", "Expected: $name", "Got: ".$node->nodeProperty('systemName') unless $node->nodeProperty('systemName') eq $name;
+    my ($this) = @_;
+    
+    my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+    
+    my $name = 'Vergon 6';
+    
+    $node->nodeProperty(name => $name);
+    failed "Failed to set a property 'name'", "Expected: $name", "Got: ".$node->name unless $node->name eq $name;
+    
+    $name = 'entity_vergon_6';
+    $node->systemName($name);
+    failed "Failed to set a property 'systemName'", "Expected: $name", "Got: ".$node->nodeProperty('systemName') unless $node->nodeProperty('systemName') eq $name;
 };
 
 test setDynamicProperty => sub {
-	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
-	
-	my $uuid = 'entity_76fd98b9e7a';
-	$node->nodeProperty(uuid => $uuid);
-	failed "Failed to set a dynamic property 'uuid'", "Expected: $uuid", "Got: ".$node->nodeProperty('uuid') unless $node->nodeProperty('uuid') eq $uuid;
+    my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+    
+    my $uuid = 'entity_76fd98b9e7a';
+    $node->nodeProperty(uuid => $uuid);
+    failed "Failed to set a dynamic property 'uuid'", "Expected: $uuid", "Got: ".$node->nodeProperty('uuid') unless $node->nodeProperty('uuid') eq $uuid;
 };
 
 test setPrivateProperty => sub {
-	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
-	
-	eval {
-		$node->nodeProperty(_private => 'failed');
-		1;
-	} and failed "Setting a private property successfull";
+    my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+    
+    eval {
+        $node->nodeProperty(_private => 'failed');
+        1;
+    } and failed "Setting a private property successfull";
 };
 
 test createNodeWithProps => sub {
-	my $uuid = 'entity_76fd98b9e7a';
-	my $name = 'Vergon 6';
-	my $systemName = 'entity_vergon_6';
-	
-	my $node = Test::DOM::TypedNode->new(
-		nodeName => 'TestNode',
-		uuid => $uuid,
-		name => $name,
-		systemName => $systemName 
-	);
-	
-	failed "Failed to get dynamic property 'uuid'" unless $node->nodeProperty('uuid') eq $uuid;
-	failed "Failed to get property 'name' through nodeProperty method" unless $node->nodeProperty('name') eq $name;
-	failed "Failed to get property name directly" unless $node->name eq $name;
+    my $uuid = 'entity_76fd98b9e7a';
+    my $name = 'Vergon 6';
+    my $systemName = 'entity_vergon_6';
+    
+    my $node = Test::DOM::TypedNode->new(
+        nodeName => 'TestNode',
+        uuid => $uuid,
+        name => $name,
+        systemName => $systemName 
+    );
+    
+    failed "Failed to get dynamic property 'uuid'" unless $node->nodeProperty('uuid') eq $uuid;
+    failed "Failed to get property 'name' through nodeProperty method" unless $node->nodeProperty('name') eq $name;
+    failed "Failed to get property name directly" unless $node->name eq $name;
 };
 
 test listNodePredefinedProps => sub {
-	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
-	
-	my @props = $node->listProperties;
-	my @expected = qw(name _private);
-	
-	failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
+    my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+    
+    my @props = $node->listProperties;
+    my @expected = qw(name _private);
+    
+    failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
 };
 
 test listNodeAllProps => sub {
-	my $node = Test::DOM::TypedNode->new(
-		nodeName => 'TestNode',
-		uuid => 'ade58f98b', # dynamic
-		name => 'noname', # predefined
-		systemName => 'no sys' # not visible to DOM
-	);
-	
-	my @props = $node->listProperties;
-	my @expected = qw(name _private uuid); # systemName is not a DOM prop
-	
-	failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
+    my $node = Test::DOM::TypedNode->new(
+        nodeName => 'TestNode',
+        uuid => 'ade58f98b', # dynamic
+        name => 'noname', # predefined
+        systemName => 'no sys' # not visible to DOM
+    );
+    
+    my @props = $node->listProperties;
+    my @expected = qw(name _private uuid); # systemName is not a DOM prop
+    
+    failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
 };
 
 test MemoryLeaks => sub {
-	my $doc = new IMPL::DOM::Document(nodeName => 'Root');
-	weaken($doc);
-	
-	assert(not defined $doc);
+    my $doc = new IMPL::DOM::Document(nodeName => 'Root');
+    weaken($doc);
+    
+    assert(not defined $doc);
 };
 
 package Test::DOM::TypedNode;
@@ -242,9 +242,9 @@
 __PACKAGE__->PassThroughArgs;
 
 BEGIN {
-	public _dom property name => prop_all;
-	public property systemName => prop_all;
-	private _dom property _private => prop_all;   
+    public _dom property name => prop_all;
+    public property systemName => prop_all;
+    private _dom property _private => prop_all;   
 }