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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download) (as text)
Sun Jul 29 03:49:00 2007 UTC (17 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +15 -3 lines
File MIME type: application/x-troff
++ 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 wakaba 1.1 #!/usr/bin/perl
2     use strict;
3     use Test;
4 wakaba 1.4 BEGIN { plan tests => 81 }
5 wakaba 1.1
6     require Message::DOM::DOMImplementation;
7     use Message::Util::Error;
8    
9 wakaba 1.4 my $dom = Message::DOM::DOMImplementation->new;
10 wakaba 1.1 my $doc = $dom->create_document;
11    
12     my $ent = $doc->create_general_entity ('entity');
13    
14 wakaba 1.3 for my $prop (qw/has_replacement_tree is_externally_declared/) {
15 wakaba 1.1 ok $ent->can ($prop) ? 1 : 0, 1, 'can ' . $prop;
16    
17     for (1, 0, '') {
18     $ent->$prop ($_);
19     ok $ent->$prop ? 1 : 0, $_ ? 1 : 0, $prop . $_;
20     }
21    
22     $ent->$prop (undef);
23     ok $ent->$prop ? 1 : 0, 0, $prop . ' undef';
24     }
25    
26 wakaba 1.3 for my $prop (qw/input_encoding notation_name public_id system_id/) {
27 wakaba 1.1 ok $ent->can ($prop) ? 1 : 0, 1, 'can ' . $prop;
28    
29     for ('-//...//EN', 'http://absuri.test/', 'reluri',
30 wakaba 1.3 'utf-8', 'x-sjis',
31 wakaba 1.2 qq('illegal"), qq'\x{4E00}', ' ', 0, '') {
32 wakaba 1.1 $ent->$prop ($_);
33     ok $ent->$prop, $_, $prop . $_;
34     }
35    
36     $ent->$prop (undef);
37     ok $ent->$prop, undef, $prop . ' undef';
38     }
39    
40     ## |manakaiDeclarationBaseURI|
41     {
42     my $doc2 = $doc->implementation->create_document;
43     my $ent = $doc2->create_general_entity ('entity');
44    
45     ok $ent->can ('manakai_declaration_base_uri') ? 1 : 0, 1,
46     'can manakai_declaration_base_uri';
47    
48     $doc2->document_uri (q<http://www.example/>);
49     ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
50     'manakai_declaration_base_uri document_uri';
51    
52     $ent->manakai_declaration_base_uri (q<ftp://www.example/>);
53     ok $ent->manakai_declaration_base_uri, q<ftp://www.example/>,
54     'manakai_declaration_base_uri explicit';
55     ok $ent->base_uri, q<http://www.example/>,
56     'manakai_declaration_base_uri (base_uri)';
57    
58     $ent->manakai_declaration_base_uri (undef);
59     ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
60     'manakai_declaration_base_uri reset';
61     }
62    
63     ## |manakaiEntityBaseURI|
64     {
65     my $doc2 = $doc->implementation->create_document;
66     my $ent = $doc2->create_general_entity ('entity');
67     ok $ent->manakai_entity_base_uri, undef, "Entity->manakai_entity_base_uri [0]";
68    
69     $doc2->document_uri (q<http://www.example/>);
70     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
71     "Entity->manakai_entity_base_uri [1]";
72    
73     $ent->manakai_entity_base_uri (q<ftp://www.example/>);
74     ok $ent->manakai_entity_base_uri, q<ftp://www.example/>,
75     "Entity->manakai_entity_base_uri [2]";
76     ok $ent->base_uri, q<http://www.example/>,
77     "Entity->manakai_entity_base_uri base_uri [2]";
78    
79     $ent->manakai_entity_base_uri (undef);
80     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
81     "Entity->manakai_entity_base_uri [3]";
82    
83     $ent->manakai_entity_uri (q<https://www.example/>);
84     ok $ent->manakai_entity_base_uri, q<https://www.example/>,
85     "Entity->manakai_entity_base_uri [4]";
86     ok $ent->base_uri, q<http://www.example/>,
87     "Entity->manakai_entity_base_uri base_uri [4]";
88    
89     $ent->manakai_entity_uri (undef);
90     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
91     "Entity->manakai_entity_base_uri [5]";
92     }
93    
94     ## |manakaiEntityURI|
95     {
96     my $doc2 = $doc->implementation->create_document;
97     my $ent = $doc2->create_general_entity ('entity');
98     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [0]";
99    
100     $doc2->document_uri (q<http://www.document.example/>);
101     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [1]";
102    
103     $ent->manakai_declaration_base_uri (q<http://decl.example/>);
104     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [2]";
105    
106     $ent->system_id (q<sysid>);
107     ok $ent->manakai_entity_uri, q<http://decl.example/sysid>,
108     "Entity->manakai_entity_uri [3]";
109    
110     $ent->manakai_entity_uri (q<http://enturi.example/>);
111     ok $ent->manakai_entity_uri, q<http://enturi.example/>,
112     "Entity->manakai_entity_uri [4]";
113    
114     $ent->manakai_entity_uri (undef);
115     ok $ent->manakai_entity_uri, q<http://decl.example/sysid>,
116     "Entity->manakai_entity_uri [5]";
117     }
118    
119 wakaba 1.4 ## |xmlVersion|
120     {
121     my $node = $doc->create_general_entity ('ent');
122     ok $node->xml_version, undef, 'xml_version [1]';
123     $node->xml_version ('1.0');
124     ok $node->xml_version, '1.0', 'xml_version [2]';
125     $node->xml_version ('1.1');
126     ok $node->xml_version, '1.1', 'xml_version [3]';
127     $node->xml_version (undef);
128     ok $node->xml_version, undef, 'xml_version [4]';
129     }
130    
131 wakaba 1.1 =head1 LICENSE
132    
133     Copyright 2007 Wakaba <w@suika.fam.cx>
134    
135     This program is free software; you can redistribute it and/or
136     modify it under the same terms as Perl itself.
137    
138     =cut
139    
140 wakaba 1.4 ## $Date: 2007/07/08 13:04:39 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24