/[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.2 - (hide annotations) (download) (as text)
Sun Jun 17 14:15:39 2007 UTC (17 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +4 -4 lines
File MIME type: application/x-troff
++ manakai/t/ChangeLog	17 Jun 2007 14:14:51 -0000
	* DOM-Node.t: |notation_name| test added.

	* DOM-Entity.t: |notation_name| test added.

2007-06-17  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	17 Jun 2007 14:13:48 -0000
	* AttributeDefinition.pm (____new): Set an empty list
	to the |allowed_tokens| attribute.
	(allowed_token): Alpha version.

	* DocumentType.pm (get_element_type_definition_node,
	get_notation_node): ALpha version.

	* ElementTypeDefinition.pm (attribute_definitions): Alpha 2
	version.

	* Entity.pm (notation_name): Implemented.

2007-06-17  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 #!/usr/bin/perl
2     use strict;
3     use Test;
4 wakaba 1.2 BEGIN { plan tests => 54 }
5 wakaba 1.1
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 $ent = $doc->create_general_entity ('entity');
13    
14     for my $prop (qw/has_replacement_tree/) {
15     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.2 for my $prop (qw/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.2 qq('illegal"), qq'\x{4E00}', ' ', 0, '') {
31 wakaba 1.1 $ent->$prop ($_);
32     ok $ent->$prop, $_, $prop . $_;
33     }
34    
35     $ent->$prop (undef);
36     ok $ent->$prop, undef, $prop . ' undef';
37     }
38    
39     ## |manakaiDeclarationBaseURI|
40     {
41     my $doc2 = $doc->implementation->create_document;
42     my $ent = $doc2->create_general_entity ('entity');
43    
44     ok $ent->can ('manakai_declaration_base_uri') ? 1 : 0, 1,
45     'can manakai_declaration_base_uri';
46    
47     $doc2->document_uri (q<http://www.example/>);
48     ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
49     'manakai_declaration_base_uri document_uri';
50    
51     $ent->manakai_declaration_base_uri (q<ftp://www.example/>);
52     ok $ent->manakai_declaration_base_uri, q<ftp://www.example/>,
53     'manakai_declaration_base_uri explicit';
54     ok $ent->base_uri, q<http://www.example/>,
55     'manakai_declaration_base_uri (base_uri)';
56    
57     $ent->manakai_declaration_base_uri (undef);
58     ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
59     'manakai_declaration_base_uri reset';
60     }
61    
62     ## |manakaiEntityBaseURI|
63     {
64     my $doc2 = $doc->implementation->create_document;
65     my $ent = $doc2->create_general_entity ('entity');
66     ok $ent->manakai_entity_base_uri, undef, "Entity->manakai_entity_base_uri [0]";
67    
68     $doc2->document_uri (q<http://www.example/>);
69     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
70     "Entity->manakai_entity_base_uri [1]";
71    
72     $ent->manakai_entity_base_uri (q<ftp://www.example/>);
73     ok $ent->manakai_entity_base_uri, q<ftp://www.example/>,
74     "Entity->manakai_entity_base_uri [2]";
75     ok $ent->base_uri, q<http://www.example/>,
76     "Entity->manakai_entity_base_uri base_uri [2]";
77    
78     $ent->manakai_entity_base_uri (undef);
79     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
80     "Entity->manakai_entity_base_uri [3]";
81    
82     $ent->manakai_entity_uri (q<https://www.example/>);
83     ok $ent->manakai_entity_base_uri, q<https://www.example/>,
84     "Entity->manakai_entity_base_uri [4]";
85     ok $ent->base_uri, q<http://www.example/>,
86     "Entity->manakai_entity_base_uri base_uri [4]";
87    
88     $ent->manakai_entity_uri (undef);
89     ok $ent->manakai_entity_base_uri, q<http://www.example/>,
90     "Entity->manakai_entity_base_uri [5]";
91     }
92    
93     ## |manakaiEntityURI|
94     {
95     my $doc2 = $doc->implementation->create_document;
96     my $ent = $doc2->create_general_entity ('entity');
97     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [0]";
98    
99     $doc2->document_uri (q<http://www.document.example/>);
100     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [1]";
101    
102     $ent->manakai_declaration_base_uri (q<http://decl.example/>);
103     ok $ent->manakai_entity_uri, undef, "Entity->manakai_entity_uri [2]";
104    
105     $ent->system_id (q<sysid>);
106     ok $ent->manakai_entity_uri, q<http://decl.example/sysid>,
107     "Entity->manakai_entity_uri [3]";
108    
109     $ent->manakai_entity_uri (q<http://enturi.example/>);
110     ok $ent->manakai_entity_uri, q<http://enturi.example/>,
111     "Entity->manakai_entity_uri [4]";
112    
113     $ent->manakai_entity_uri (undef);
114     ok $ent->manakai_entity_uri, q<http://decl.example/sysid>,
115     "Entity->manakai_entity_uri [5]";
116     }
117    
118     =head1 LICENSE
119    
120     Copyright 2007 Wakaba <w@suika.fam.cx>
121    
122     This program is free software; you can redistribute it and/or
123     modify it under the same terms as Perl itself.
124    
125     =cut
126    
127 wakaba 1.2 ## $Date: 2007/06/17 13:37:42 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24