This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Encode: sync with CPAN version 3.18
[perl5.git] / cpan / Encode / t / xml.t
1 BEGIN {
2     if ( $] < 5.009 ) {
3         print "1..0 # Skip: Perl <= 5.9 or later required\n";
4         exit 0;
5     }
6 }
7 use strict;
8 use warnings;
9
10 use Encode;
11 use Test::More;
12
13 my $content = String->new("--\x{30c6}--");
14 my $text = Encode::encode('latin1', $content, Encode::FB_XMLCREF);
15 is $text, "--&#x30c6;--";
16
17 done_testing();
18
19 package String;
20 use overload
21   '""' => sub { ${$_[0]} }, fallback => 1;
22
23 sub new {
24     my($class, $str) = @_;
25     bless \$str, $class;
26 }
27
28 1;