|
1 | 1 | #!/usr/bin/perl -w |
2 | 2 |
|
3 | 3 | use Test; |
| 4 | +use utf8; |
4 | 5 |
|
5 | | -BEGIN { $| = 1; plan tests => 100; } |
| 6 | +BEGIN { $| = 1; plan tests => 105; } |
6 | 7 |
|
7 | 8 | use XML::Generator (); |
8 | 9 | ok(1); |
@@ -260,10 +261,26 @@ ok($xml, '<foo>< |
260 | 261 | </bar> |
261 | 262 | </foo>'); |
262 | 263 |
|
| 264 | +$x = XML::Generator->new(); |
| 265 | +$xml = $x->foo('パスワードをお忘れの方'); |
| 266 | +ok($xml, '<foo>パスワードをお忘れの方</foo>'); |
| 267 | + |
| 268 | +$x = XML::Generator->new(':strict'); |
| 269 | +$xml = $x->foo('パスワードをお忘れの方'); |
| 270 | +ok($xml, '<foo>パスワードをお忘れの方</foo>'); |
| 271 | +ok($xml, "<foo>\x{30D1}\x{30B9}\x{30EF}\x{30FC}\x{30C9}\x{3092}\x{304A}\x{5FD8}\x{308C}\x{306E}\x{65B9}</foo>"); |
| 272 | + |
| 273 | +$x = XML::Generator->new(':strict', escape => 'high-bit'); |
| 274 | +$xml = $x->foo('パスワードをお忘れの方'); |
| 275 | +ok($xml, '<foo>パスワードをお忘れの方</foo>'); |
| 276 | + |
263 | 277 | $x = XML::Generator->new(':strict', escape => 'high-bit'); |
264 | 278 | $xml = $x->foo("\\<\242", $x->xmlpi('g')); |
265 | 279 | ok($xml, '<foo><¢<?g?></foo>'); |
266 | 280 |
|
| 281 | +$xml = $x->foo("\\<\x{2603}", $x->xmlpi('g')); |
| 282 | +ok($xml, '<foo><☃<?g?></foo>'); |
| 283 | + |
267 | 284 | { my $w; local $SIG{__WARN__} = sub { $w .= $_[0] }; |
268 | 285 | $x = XML::Generator->new(':import'); |
269 | 286 | ok($w =~ /Useless use of/, 1); $w = ''; |
|
0 commit comments