/[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.3 - (hide annotations) (download) (as text)
Sun Jul 8 13:04:39 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +5 -4 lines
File MIME type: application/x-troff
++ manakai/t/ChangeLog	8 Jul 2007 13:03:58 -0000
	* DOM-Element.t: Tests for |attributes| are added.

	* DOM-Entity.t: Tests for |is_externally_declared|
	and |input_encoding| are added.

	* DOM-Node.t: Test data for |tag_name| and
	|get_feature| are added.

2007-07-08  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	8 Jul 2007 13:02:01 -0000
	* Attr.pm (value, node_value): Now it is defined
	as |text_content| itself.

	* AttributeDefinition.pm, ElementTypeDefinition.pm,
	Node.pm (AUTOLOAD): Unused block is removed.

	* CDATASection.pm, DocumentFragment.pm (AUTOLOAD): Removed.  Unused.

	* DocumentType.pm (internal_subset): Implemented.

	* Entity.pm (is_externally_declared, input_encoding,
	xml_version): Implemented.

	* ProcessingInstruction.pm (target, data): Implemented.

2007-07-08  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 #!/usr/bin/perl
2     use strict;
3     use Test;
4 wakaba 1.3 BEGIN { plan tests => 77 }
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 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     =head1 LICENSE
120    
121     Copyright 2007 Wakaba <w@suika.fam.cx>
122    
123     This program is free software; you can redistribute it and/or
124     modify it under the same terms as Perl itself.
125    
126     =cut
127    
128 wakaba 1.3 ## $Date: 2007/06/17 14:15:39 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24