File: test_3_50.t

package info (click to toggle)
libxml-twig-perl 1%3A3.50-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 4,404 kB
  • ctags: 2,144
  • sloc: perl: 20,948; xml: 418; makefile: 7
file content (33 lines) | stat: -rwxr-xr-x 650 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl

use strict;
use warnings;

use XML::Twig;
use Test::More tests => 2;

use utf8;

{
my $doc=q{<d><title>title</title><para>p 1</para><para>p 2</para></d>};
my $out;
open( my $out_fh, '>', \$out);
my $t= XML::Twig->new ( twig_handlers => { _default_ => sub { $_->flush( $out_fh); } });
$t->parse( $doc);
is( $out, $doc, 'flush with _default_ handler');
}

{
my $doc=q{<d><title>title</title><para>p 1</para><para>p 2</para></d>};
my $out;
open( my $out_fh, '>', \$out);
my $t= XML::Twig->new ( twig_handlers => { 'd' => sub { $_->flush( $out_fh); } });
$t->parse( $doc);
is( $out, $doc, 'flush with handler on the root');
}


exit;