1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
2 |
use strict; |
use strict; |
3 |
require Test::Simple; |
require Test::Simple; |
4 |
require Message::Markup::XML; |
require Message::Markup::XML::Node; |
5 |
use Message::Markup::XML::QName qw/UNDEF_URI NULL_URI DEFAULT_PFX/; |
use Message::Markup::XML::QName qw/UNDEF_URI NULL_URI DEFAULT_PFX EMPTY_PFX |
6 |
|
EMPTY_URI ZERO_PFX ZERO_URI/; |
7 |
sub ok ($;$); |
sub ok ($;$); |
8 |
my $e = new Message::Markup::XML (type => '#element', local_name => 'test', |
my $e = new Message::Markup::XML::Node |
9 |
namespace_uri => 'http://something.test/'); |
(type => '#element', local_name => 'test', |
10 |
|
namespace_uri => 'http://something.test/'); |
11 |
use Carp q(verbose); |
use Carp q(verbose); |
12 |
my @reg_p2n = ( |
my @reg_p2n = ( |
13 |
{ |
{ |
97 |
opt => {check_name => 1, resolve_name_uri_relative => 1}, |
opt => {check_name => 1, resolve_name_uri_relative => 1}, |
98 |
result => 1, |
result => 1, |
99 |
}, |
}, |
100 |
|
{ |
101 |
|
prefix => EMPTY_PFX, |
102 |
|
name => q<about:name>, |
103 |
|
opt => {check_prefix => 1, use_prefix_empty => 0}, |
104 |
|
result => 0, |
105 |
|
}, |
106 |
|
{ |
107 |
|
prefix => EMPTY_PFX, |
108 |
|
name => q<about:name>, |
109 |
|
opt => {check_prefix => 1, use_prefix_empty => 1}, |
110 |
|
result => 1, |
111 |
|
}, |
112 |
|
{ |
113 |
|
prefix => ZERO_PFX, |
114 |
|
name => q<about:name>, |
115 |
|
opt => {check_prefix => 1}, |
116 |
|
result => 0, |
117 |
|
}, |
118 |
); |
); |
119 |
|
|
120 |
my @get_p2n = ( |
my @get_p2n = ( |
171 |
___dont_register => 1}, |
___dont_register => 1}, |
172 |
result => 1, |
result => 1, |
173 |
}, |
}, |
174 |
|
{ |
175 |
|
prefix => EMPTY_PFX, |
176 |
|
name => q<http://test.test/2>, |
177 |
|
opt => {use_prefix_empty => 1}, |
178 |
|
result => 1, |
179 |
|
}, |
180 |
); |
); |
181 |
|
|
182 |
my @qname = ( |
my @qname = ( |
263 |
check_local_name => 1, qname_separator => '|', |
check_local_name => 1, qname_separator => '|', |
264 |
use_local_name_star => 1}, |
use_local_name_star => 1}, |
265 |
}, |
}, |
266 |
|
{ |
267 |
|
qname => q":b", |
268 |
|
prefix => EMPTY_PFX, |
269 |
|
lname => q:b:, |
270 |
|
result => 0, |
271 |
|
opt => {check_qname => 1, check_prefix => 1, |
272 |
|
check_local_name => 1, |
273 |
|
use_prefix_empty => 0}, |
274 |
|
}, |
275 |
|
{ |
276 |
|
qname => q":b", |
277 |
|
prefix => EMPTY_PFX, |
278 |
|
lname => q:b:, |
279 |
|
result => 1, |
280 |
|
opt => {check_qname => 1, check_prefix => 1, |
281 |
|
check_local_name => 1, |
282 |
|
use_prefix_empty => 1}, |
283 |
|
}, |
284 |
|
{ |
285 |
|
qname => q"b", |
286 |
|
prefix => DEFAULT_PFX, |
287 |
|
lname => q:b:, |
288 |
|
result => 1, |
289 |
|
opt => {check_qname => 1, check_prefix => 1, |
290 |
|
check_local_name => 1, |
291 |
|
use_prefix_empty => 1}, |
292 |
|
}, |
293 |
); |
); |
294 |
|
|
295 |
my @gen_pfx = ( |
my @gen_pfx = ( |
411 |
xname => [NULL_URI, q:bar:], |
xname => [NULL_URI, q:bar:], |
412 |
opt => {use_prefix_default => 1, use_name_null => 1}, |
opt => {use_prefix_default => 1, use_name_null => 1}, |
413 |
}, |
}, |
414 |
|
{ |
415 |
|
reset => 0, |
416 |
|
ns => {(EMPTY_PFX) => q<about:>}, |
417 |
|
qname => q":bar", |
418 |
|
xname => [q<about:>, q:bar:], |
419 |
|
opt => {use_prefix_empty => 1}, |
420 |
|
}, |
421 |
|
{ |
422 |
|
reset => 0, |
423 |
|
ns => {(EMPTY_PFX) => q<about:>, |
424 |
|
(DEFAULT_PFX) => q<data:,>}, |
425 |
|
qname => q"bar", |
426 |
|
xname => [q<data:,>, q:bar:], |
427 |
|
opt => {use_prefix_empty => 1, use_prefix_default => 1}, |
428 |
|
}, |
429 |
); |
); |
430 |
|
|
431 |
Test::Simple->import (tests => scalar (@reg_p2n) |
Test::Simple->import (tests => scalar (@reg_p2n) |
535 |
ok $chk->{success} && ($_->{qname} eq $chk->{qname}), 'Expand->QName: '.$chk->{reason}; |
ok $chk->{success} && ($_->{qname} eq $chk->{qname}), 'Expand->QName: '.$chk->{reason}; |
536 |
} |
} |
537 |
|
|
538 |
print $e; |
#print $e; |