242 |
@@lang:en |
@@lang:en |
243 |
|
|
244 |
ElementTypeBinding: |
ElementTypeBinding: |
245 |
|
@Name: PTests |
246 |
|
@ElementType: |
247 |
|
dis:ResourceDef |
248 |
|
@ShadowContent: |
249 |
|
@@ForCheck: ManakaiDOM|ForClass |
250 |
|
@@DISCore:resourceType: test|ParserTestSet |
251 |
|
|
252 |
|
ElementTypeBinding: |
253 |
|
@Name: PTest |
254 |
|
@ElementType: |
255 |
|
dis:ResourceDef |
256 |
|
@ShadowContent: |
257 |
|
@@ForCheck: ManakaiDOM|ForClass |
258 |
|
@@DISCore:resourceType: test|ParserTest |
259 |
|
|
260 |
|
ElementTypeBinding: |
261 |
|
@Name: DEnt |
262 |
|
@ElementType: |
263 |
|
dis:ResourceDef |
264 |
|
@ShadowContent: |
265 |
|
@@DISCore:resourceType: test|RootEntity |
266 |
|
|
267 |
|
ElementTypeBinding: |
268 |
@Name: IFClsETDef |
@Name: IFClsETDef |
269 |
@ElementType: |
@ElementType: |
270 |
dis:ResourceDef |
dis:ResourceDef |
777 |
$self->{docel} = $self->{doc}->document_element; |
$self->{docel} = $self->{doc}->document_element; |
778 |
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns', <Q::sw09|>); |
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns', <Q::sw09|>); |
779 |
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns:h2', <Q::xhtml2|>); |
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns:h2', <Q::xhtml2|>); |
780 |
|
$self->{docel}->markup_language_name ('SuikaWiki'); |
781 |
$self->{docel}->markup_language_version ('0.10'); |
$self->{docel}->markup_language_version ('0.10'); |
782 |
$self->{docel}->append_child |
$self->{docel}->append_child |
783 |
($self->{doc}->create_element_ns |
($self->{doc}->create_element_ns |
2064 |
$parent->{text}->[-1]->manakai_append_text ($tagString); |
$parent->{text}->[-1]->manakai_append_text ($tagString); |
2065 |
} |
} |
2066 |
|
|
2067 |
|
@PTests: |
2068 |
|
@@PTest: |
2069 |
|
@@@QName: p.empty.test |
2070 |
|
@@@DEnt: |
2071 |
|
@@@@test:value: |
2072 |
|
\ |
2073 |
|
@@@test:domTree: |
2074 |
|
document { |
2075 |
|
element { |
2076 |
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2077 |
|
local-name: 'document'; |
2078 |
|
markup-language-name: 'SuikaWiki'; |
2079 |
|
markup-language-version: '0.10'; |
2080 |
|
element { |
2081 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2082 |
|
local-name: 'head'; |
2083 |
|
has-child-nodes: false; |
2084 |
|
} |
2085 |
|
element { |
2086 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2087 |
|
local-name: 'body'; |
2088 |
|
has-child-nodes: false; |
2089 |
|
} |
2090 |
|
} |
2091 |
|
} |
2092 |
|
@@PTest: |
2093 |
|
@@@QName: p.magic.sw09.test |
2094 |
|
@@@DEnt: |
2095 |
|
@@@@test:value: |
2096 |
|
#?SuikaWiki/0.9 |
2097 |
|
@@@test:domTree: |
2098 |
|
document { |
2099 |
|
element { |
2100 |
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2101 |
|
local-name: 'document'; |
2102 |
|
markup-language-name: 'SuikaWiki'; |
2103 |
|
markup-language-version: '0.9'; |
2104 |
|
element { |
2105 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2106 |
|
local-name: 'head'; |
2107 |
|
has-child-nodes: false; |
2108 |
|
} |
2109 |
|
element { |
2110 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2111 |
|
local-name: 'body'; |
2112 |
|
has-child-nodes: false; |
2113 |
|
} |
2114 |
|
} |
2115 |
|
} |
2116 |
|
@@PTest: |
2117 |
|
@@@QName: p.magic.swimg09.test |
2118 |
|
@@@DEnt: |
2119 |
|
@@@@test:value: |
2120 |
|
#?SuikaWikiImage/0.9 |
2121 |
|
@@@test:domTree: |
2122 |
|
document { |
2123 |
|
element { |
2124 |
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2125 |
|
local-name: 'document'; |
2126 |
|
markup-language-name: 'SuikaWikiImage'; |
2127 |
|
markup-language-version: '0.9'; |
2128 |
|
element { |
2129 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2130 |
|
local-name: 'head'; |
2131 |
|
has-child-nodes: false; |
2132 |
|
} |
2133 |
|
element { |
2134 |
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2135 |
|
local-name: 'body'; |
2136 |
|
has-child-nodes: false; |
2137 |
|
} |
2138 |
|
} |
2139 |
|
} |
2140 |
|
|
2141 |
|
@@PerlDef: |
2142 |
|
my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |
2143 |
|
'Core' => '3.0', |
2144 |
|
'XML' => '3.0', |
2145 |
|
}); |
2146 |
|
|
2147 |
|
for my $test_data (@$TestData) { |
2148 |
|
my $parser = <Class::ManakaiSWDMLParser>->new ($impl); |
2149 |
|
|
2150 |
|
$test->start_new_test ($test_data->{uri}); |
2151 |
|
my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}}; |
2152 |
|
my $not_ok; |
2153 |
|
|
2154 |
|
## -- DOM Configuration Parameters |
2155 |
|
|
2156 |
|
my $pcfg = $parser->dom_config; |
2157 |
|
for (keys %{$test_data->{dom_config}}) { |
2158 |
|
$pcfg->set_parameter ($_ => $test_data->{dom_config}->{$_}); |
2159 |
|
} |
2160 |
|
|
2161 |
|
# $pcfg->set_parameter ('error-handler' => sub ($$) { |
2162 |
|
# my (undef, $err) = @_; |
2163 |
|
# my $err_type = $err->type; |
2164 |
|
# if ($test_data->{dom_error}->{$err_type}) { |
2165 |
|
# $test->assert_error_equals |
2166 |
|
# (actual_value => $err, |
2167 |
|
# expected_hash => shift @{$test_data->{dom_error} |
2168 |
|
# ->{$err_type}}); |
2169 |
|
# } else { # Uncatched error |
2170 |
|
# warn $err; |
2171 |
|
# unless ($err->severity == <C::c|DOMError.SEVERITY_WARNING>) { |
2172 |
|
# $test->failure_comment ('Unexpected error |'.$err->type.'|'); |
2173 |
|
# $not_ok = true; |
2174 |
|
# } |
2175 |
|
# } |
2176 |
|
# return true; # continue as far as possible |
2177 |
|
# }); |
2178 |
|
|
2179 |
|
## -- Test and Result |
2180 |
|
|
2181 |
|
my $doc; |
2182 |
|
try { |
2183 |
|
$doc = $parser->parse_string ($doc_ent->{<Q::test|value>}); |
2184 |
|
$test->assert_dom_tree_equals |
2185 |
|
(actual_value => $doc, |
2186 |
|
expected_hash => $test_data->{dom_tree}); |
2187 |
|
for (values %{$test_data->{dom_error}||{}}) { |
2188 |
|
if (@$_) { |
2189 |
|
$test->failure_comment |
2190 |
|
(@$_.' |DOMError|s of type |'. |
2191 |
|
$_->[0]->{type}->{value}.'| are not reported'); |
2192 |
|
$not_ok = true; |
2193 |
|
} |
2194 |
|
} |
2195 |
|
$not_ok ? $test->not_ok : $test->ok; |
2196 |
|
undef $doc; |
2197 |
|
} catch Message::Util::IF::DTException with { |
2198 |
|
require Message::DOM::SimpleLS; |
2199 |
|
my $ls = Message::DOM::SimpleLS::ManakaiDOMSimpleXMLSerializer->new; |
2200 |
|
print STDERR $ls->write_to_string ($doc); |
2201 |
|
} otherwise { |
2202 |
|
my $err = shift; |
2203 |
|
warn $err; |
2204 |
|
$test->not_ok; |
2205 |
|
}; |
2206 |
|
} |
2207 |
|
##SWDMLParser |
2208 |
|
|