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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Wed Aug 22 10:59:43 2007 UTC (17 years, 3 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-4-0, HEAD
Changes since 1.1: +39 -3 lines
File MIME type: application/x-troff
++ manakai/lib/Message/CGI/ChangeLog	22 Aug 2007 10:59:39 -0000
2007-08-12  Wakaba  <wakaba@suika.fam.cx>

	* HTTP.pm (path_info, query_string, request_method,
	script_name): New attributes.  The class now
	implements the |Message::IF::HTTPCGIRequest| interface.

++ manakai/t/ChangeLog	22 Aug 2007 10:58:00 -0000
2007-08-22  Wakaba  <wakaba@suika.fam.cx>

	* DOM-DocumentType.t, DOM-AttributeDefinition.t,
	DOM-Entity.t, DOM-Notation.t: Tests for factory
	methods are added.

	* DOM-ElementTypeDefinition.t: New test script.

1 #!/usr/bin/perl
2 use strict;
3 use Test;
4 BEGIN { plan tests => 43 }
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 for my $v (
13 [a => undef],
14 [abc => undef],
15 ['a:b' => undef],
16 [1 => 'INVALID_CHARACTER_ERR'],
17 [1234 => 'INVALID_CHARACTER_ERR'],
18 ["\x{3001}\x{3002}" => 'INVALID_CHARACTER_ERR'], ## XML 1.1 Name
19 [':aa' => undef],
20 [':1' => undef],
21 ['a:' => undef],
22 ["a:\x{3005}b" => undef], ## XML 1.0 Name, XML 1.1 QName
23 ) {
24 $doc->strict_error_checking (1);
25 if (not defined $v->[1]) {
26 try {
27 my $dt = $doc->create_notation ($v->[0]);
28 ok $dt->node_name, $v->[0], 'create_notation '.$v->[0];
29 } catch Message::IF::DOMException with {
30 my $e = shift;
31 ok $e->type, undef, 'create_notation '.$v->[0];
32 };
33 } else {
34 try {
35 $doc->create_notation ($v->[0]);
36 ok 0, 1, 'create_notation '.$v->[0];
37 } catch Message::IF::DOMException with {
38 my $e = shift;
39 ok $e->type, $v->[1], 'create_notation '.$v->[0];
40 };
41 }
42 $doc->strict_error_checking (0);
43 my $dt = $doc->create_notation ($v->[0]);
44 ok $dt->node_name, $v->[0], 'create_notation s '.$v->[0];
45 }
46 $doc->strict_error_checking (1);
47
48 my $ent = $doc->create_notation ('entity');
49
50 for my $prop (qw/public_id system_id/) {
51 ok $ent->can ($prop) ? 1 : 0, 1, 'can ' . $prop;
52
53 for ('-//...//EN', 'http://absuri.test/', 'reluri',
54 qq('illegal"), qq'\x{4E00}', 0, '') {
55 $ent->$prop ($_);
56 ok $ent->$prop, $_, $prop . $_;
57 }
58
59 $ent->$prop (undef);
60 ok $ent->$prop, undef, $prop . ' undef';
61 }
62
63 ## |manakaiDeclarationBaseURI|
64 {
65 my $doc2 = $doc->implementation->create_document;
66 my $ent = $doc2->create_notation ('notation');
67
68 ok $ent->can ('manakai_declaration_base_uri') ? 1 : 0, 1,
69 'can manakai_declaration_base_uri';
70
71 $doc2->document_uri (q<http://www.example/>);
72 ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
73 'manakai_declaration_base_uri document_uri';
74
75 $ent->manakai_declaration_base_uri (q<ftp://www.example/>);
76 ok $ent->manakai_declaration_base_uri, q<ftp://www.example/>,
77 'manakai_declaration_base_uri explicit';
78 ok $ent->base_uri, q<http://www.example/>,
79 'manakai_declaration_base_uri (base_uri)';
80
81 $ent->manakai_declaration_base_uri (undef);
82 ok $ent->manakai_declaration_base_uri, q<http://www.example/>,
83 'manakai_declaration_base_uri reset';
84 }
85
86 =head1 LICENSE
87
88 Copyright 2007 Wakaba <w@suika.fam.cx>
89
90 This program is free software; you can redistribute it and/or
91 modify it under the same terms as Perl itself.
92
93 =cut
94
95 ## $Date: 2007/06/17 13:37:42 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24