use strict;
use XML::Builder;
use Test::More tests => 6;
isa_ok my $xb = XML::Builder->new, 'XML::Builder';
is $xb->escape_text( qq(<\x{FF34}\x{FF25}\x{FF33}\x{FF34} "&' d\xE3t\xE3>) ),
qq(<TEST "&' dãtã>),
'text is properly encoded';
is $xb->escape_attr( qq(<\x{FF34}\x{FF25}\x{FF33}\x{FF34}\n"&'\rd\xE3t\xE3>) ),
qq(<TEST "&' dãtã>),
'attribute values are properly encoded';
isa_ok my $x = $xb->null_ns, 'XML::Builder::NS::QNameFactory';
is $x->p( 'AT&T >_<' )->as_string, '<p>AT&T >_<</p>', 'automatic entity escaping';
is $x->p( $xb->unsafe( 'AT&T >_<' ) )->as_string, '<p>AT&T >_<</p>', 'unsafe text';