Parent Directory | Revision Log
++ manakai/t/ChangeLog 17 Jun 2007 13:37:22 -0000 2007-06-17 Wakaba <wakaba@suika.fam.cx> * DOM-Attr.t, DOM-AttributeDefinition.t, DOM-DocumentType.t, DOM-Element.t, DOM-Entity.t, DOM-EntityReference.t, DOM-Notation.t, DOM-ProcessingInstruction.t: New. * DOM-Document.t, DOM-Node.t: Tests for newly-implemented attributes and methods are added. * Makefile (test-module-dom-old): Renamed from |test-module-dom|. (test-module-dom): New. ++ manakai/lib/Message/DOM/ChangeLog 17 Jun 2007 13:34:54 -0000 2007-06-17 Wakaba <wakaba@suika.fam.cx> * Attr.pm (____new): Initialize |specified| as 1. (base_uri, manakai_attribute_type, specified): Implemented. (prefix): Don't check read-only flag unless |strict_error_checking|. (value): Call |text_content| for now. * AttributeDefinition.pm (DeclaredValueType, DefaultValueType): Added. (declared_type, default_type): Implemented. * CharacterData.pm (____new): Allow a scalar reference as an input for the |data| attribute. (base_uri, manakai_append_text): Implemented. * DOMConfiguration.pm (set_parameter): Resetting implemented. * DOMDocument.pm (____new): Set default values to configuration parameter whose default is true. (document_uri, input_encoding): Implemented. (all_declarations_processed, manakai_is_html): Implemented. (base_uri, manakai_append_text, manakai_entity_base_uri, strict_error_checking, xml_encoding, xml_version, xml_standalone): Implemented. * DOMElement.pm (manakai_base_uri, base_uri): Implemented. (get_attribute, get_attribute_node): Alpha version. (set_attribute_node, set_attribute_node_ns): Implemented. (set_attribute_ns): Accept non-ARRAY qualified name. * DOMException.pm (___error_def): |WRONG_DOCUMENT_ERR|, |NOT_SUPPORTED_ERR|, and |INUSE_ATTRIBUTE_ERR| are added. * DocumentType.pm (public_id, system_id): Implemented. (base_uri, declaration_base_uri, manakai_declaration_base_uri, manakai_append_text): Implemented. (element_types, general_entities, notations, set_element_type_definition_node, set_general_entity_node, set_notation_node): Alpha version. * ElementTypeDefinition.pm (manakai_append_text): Implemented. (attribute_definitions, set_attribute_definition_node): Alpha version. * Entity.pm (has_replacement_tree, public_id, system_id, manakai_declaration_base_uri, manakai_entity_base_uri, manakai_entity_uri): Implemented. * EntityReference.pm (manakai_expanded, manakai_external): Implemented. (base_uri, manakai_entity_base_uri): Implemented. * Node.pm (base_uri): Implemented. (text_content): Don't check read-only or not unless |strict_error_checking|. (manakai_append_text): Implemented. (get_feature): Alpha. (manakai_set_read_only): Implemented. * Notation.pm (public_id, system_id, manakai_append_text, manakai_declaration_base_uri): Implemented. * ProcessingInstruction.pm (manakai_base_uri, base_uri, manakai_append_text): Implemented.
1 | wakaba | 1.1 | #!/usr/bin/perl |
2 | use strict; | ||
3 | use Test; | ||
4 | BEGIN { plan tests => 38 } | ||
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_element ('element'); | ||
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 | for my $method (qw/set_attribute_node set_attribute_node_ns/) { | ||
27 | my $el = $doc->create_element ('element'); | ||
28 | ok $el->can ($method) ? 1 : 0, 1, "can $method"; | ||
29 | |||
30 | my $a1 = $doc->create_attribute ('attr1'); | ||
31 | $a1->value ('value1'); | ||
32 | $a1->specified (0); | ||
33 | |||
34 | my $r1 = $el->$method ($a1); | ||
35 | ok $r1, undef, "$method return [1]"; | ||
36 | ok $el->get_attribute ('attr1'), 'value1', "$method get_attribute [1]"; | ||
37 | ok $el->get_attribute_ns (undef, 'attr1'), 'value1', | ||
38 | "$method get_attribute_ns [1]"; | ||
39 | ok $el->get_attribute_node ('attr1'), $a1, "$method get_attribute_node [1]"; | ||
40 | ok $el->get_attribute_node_ns (undef, 'attr1'), $a1, | ||
41 | "$method get_attribute_node_ns [1]"; | ||
42 | ok $a1->owner_element, $el, "$method owner_element [1]"; | ||
43 | ok $a1->specified ? 1 : 0, 1, "$method specified [1]"; | ||
44 | $a1->specified (0); | ||
45 | |||
46 | my $a2 = $doc->create_attribute ('attr1'); | ||
47 | my $r3 = $el->$method ($a2); | ||
48 | ok $r3, $a1, "$method return [2]"; | ||
49 | ok $a1->owner_element, undef, "$method owner_element [2]"; | ||
50 | ok $a1->specified ? 1 : 0, 1, "$method specified [2]"; | ||
51 | |||
52 | $el->set_attribute_ns (undef, attr => 'value'); | ||
53 | my $attr = $el->get_attribute_node_ns (undef, 'attr'); | ||
54 | $attr->specified (0); | ||
55 | my $r4 = $el->$method ($attr); | ||
56 | ok $r4, undef, "$method return [3]"; | ||
57 | ok $attr->owner_element, $el, "$method owner_element [3]"; | ||
58 | ok $attr->specified ? 1 : 0, 0, "$method specified [3]"; | ||
59 | ok $el->get_attribute_node_ns (undef, 'attr'), $attr, | ||
60 | "$method get_attribute_node_ns [3]"; | ||
61 | ok $el->get_attribute_ns (undef, 'attr'), 'value', | ||
62 | "$method get_attribute_ns [3]"; | ||
63 | } | ||
64 | |||
65 | =head1 LICENSE | ||
66 | |||
67 | Copyright 2007 Wakaba <w@suika.fam.cx> | ||
68 | |||
69 | This program is free software; you can redistribute it and/or | ||
70 | modify it under the same terms as Perl itself. | ||
71 | |||
72 | =cut | ||
73 | |||
74 | ## $Date: 2007/06/16 08:49:00 $ |
admin@suikawiki.org | ViewVC Help |
Powered by ViewVC 1.1.24 |