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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Sun Jul 29 03:49:00 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-4-0, HEAD
Changes since 1.1: +68 -3 lines
File MIME type: application/x-troff
Error occurred while calculating annotation data.
++ manakai/t/ChangeLog	19 Jul 2007 15:16:15 -0000
2007-07-19  Wakaba  <wakaba@suika.fam.cx>

	* DOM-Attr.t: New tests for |DeclaredValueType|, |specified|,
	|schemaTypeInfo|, and |isId| are added.

	* DOM-Element.t: New tests for |schemaTypeInfo| are added.

	* DOM-Entity.t: New tests for |xmlVersion| are added.

	* DOM-ProcessingInstruction.t: New tests for |node_value|,
	|data|, and |text_content| are added.

++ manakai/lib/Message/DOM/ChangeLog	19 Jul 2007 15:14:20 -0000
2007-07-19  Wakaba  <wakaba@suika.fam.cx>

	* Attr.pm (DeclaredValueType): Added.

	* ProcessingInstruction.pm (data): Accept |undef|
	as a valid input, for |text_content| (maybe) allows it.

	* TypeInfo.pm (type_namespace): The implementation was wrong.

1 #!/usr/bin/perl
2 use strict;
3 use Test;
4 BEGIN { plan tests => 33 }
5
6 require Message::DOM::DOMImplementation;
7 use Message::Util::Error;
8
9 my $dom = Message::DOM::DOMImplementation->new;
10 my $doc = $dom->create_document;
11
12 my $el = $doc->create_processing_instruction ('pi');
13
14 for my $prop (qw/manakai_base_uri/) {
15 ok $el->can ($prop) ? 1 : 0, 1, 'can ' . $prop;
16
17 for ('http://absuri.test/', 'reluri', 0, '') {
18 $el->$prop ($_);
19 ok $el->$prop, $_, $prop . $_;
20 }
21
22 $el->$prop (undef);
23 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
92
93 Copyright 2007 Wakaba <w@suika.fam.cx>
94
95 This program is free software; you can redistribute it and/or
96 modify it under the same terms as Perl itself.
97
98 =cut
99
100 ## $Date: 2007/06/17 13:37:42 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24