/[suikacvs]/messaging/manakai/t/DOM-ProcessingInstruction.t
Suika

Diff of /messaging/manakai/t/DOM-ProcessingInstruction.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by wakaba, Sun Jun 17 13:37:42 2007 UTC revision 1.2 by wakaba, Sun Jul 29 03:49:00 2007 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl
2  use strict;  use strict;
3  use Test;  use Test;
4  BEGIN { plan tests => 6 }  BEGIN { plan tests => 33 }
5    
6  require Message::DOM::DOMImplementation;  require Message::DOM::DOMImplementation;
7  use Message::Util::Error;  use Message::Util::Error;
8    
9  my $dom = Message::DOM::DOMImplementation->____new;  my $dom = Message::DOM::DOMImplementation->new;
10  my $doc = $dom->create_document;  my $doc = $dom->create_document;
11    
12  my $el = $doc->create_processing_instruction ('pi');  my $el = $doc->create_processing_instruction ('pi');
# Line 23  for my $prop (qw/manakai_base_uri/) { Line 23  for my $prop (qw/manakai_base_uri/) {
23    ok $el->$prop, undef, $prop . ' undef';    ok $el->$prop, undef, $prop . ' undef';
24  }  }
25    
26    ## |nodeValue|, |textContent|, |data|
27    {
28      my $node = $doc->create_processing_instruction ('pi', 'initial');
29      ok $node->node_value, 'initial', 'node_value [1]';
30      ok $node->text_content, 'initial', 'text_content [1]';
31      ok $node->data, 'initial', 'data [1]';
32    
33      $node->node_value ('value1');
34      ok $node->node_value, 'value1', 'node_value [2]';
35      ok $node->text_content, 'value1', 'text_content [2]';
36      ok $node->data, 'value1', 'data [2]';
37    
38      $node->node_value ('');
39      ok $node->node_value, '', 'node_value [3]';
40      ok $node->text_content, '', 'text_content [3]';
41      ok $node->data, '', 'data [3]';
42    
43      $node->text_content ('value3');
44      ok $node->node_value, 'value3', 'node_value [4]';
45      ok $node->text_content, 'value3', 'text_content [4]';
46      ok $node->data, 'value3', 'data [4]';
47    
48      $node->text_content ('');
49      ok $node->node_value, '', 'node_value [5]';
50      ok $node->text_content, '', 'text_content [5]';
51      ok $node->data, '', 'data [5]';
52    
53      $node->text_content ('value4');
54      $node->text_content (undef);
55      ok $node->node_value, '', 'node_value [6]';
56      ok $node->text_content, '', 'text_content [6]';
57      ok $node->data, '', 'data [6]';
58    
59      $node->data ('value5');
60      ok $node->node_value, 'value5', 'node_value [7]';
61      ok $node->text_content, 'value5', 'text_content [7]';
62      ok $node->data, 'value5', 'data [7]';
63    
64      $node->data ('');
65      ok $node->node_value, '', 'node_value [8]';
66      ok $node->text_content, '', 'text_content [8]';
67      ok $node->data, '', 'data [8]';
68    
69      $node->manakai_set_read_only (1);
70      try {
71        $node->node_value ('value6');
72        ok 0, 1, 'node_value [9]';
73      } catch Message::IF::DOMException with {
74        ok $_[0]->type, 'NO_MODIFICATION_ALLOWED_ERR', 'node_value [9]';
75      };
76      try {
77        $node->text_content ('value7');
78        ok 0, 1, 'text_content [9]';
79      } catch Message::IF::DOMException with {
80        ok $_[0]->type, 'NO_MODIFICATION_ALLOWED_ERR', 'text_content [9]';
81      };
82      try {
83        $node->data ('value8');
84        ok 0, 1, 'data [9]';
85      } catch Message::IF::DOMException with {
86        ok $_[0]->type, 'NO_MODIFICATION_ALLOWED_ERR', 'data [9]';
87      };
88    }
89    
90    
91  =head1 LICENSE  =head1 LICENSE
92    
93  Copyright 2007 Wakaba <w@suika.fam.cx>  Copyright 2007 Wakaba <w@suika.fam.cx>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24