10
{ warn "skipped, not tested under perl < 5.8\n"; print "1..1\nok 1\n"; exit 0; }
10
13
print "1..$nb_tests\n";
13
17
my $t= XML::Twig->new( comments => 'process',
14
18
twig_handlers => { '#COMMENT' => sub { $result .=$_->text; } },
21
25
{ print "not ok 1\n";
22
26
warn "expected: $expected\nfound : $result\n";
26
$t= XML::Twig->new( comments => 'process',
32
my $t= XML::Twig->new( comments => 'process',
27
33
twig_handlers => { '#COMMENT' => sub { $result .=$_->text; } },
29
35
$t->parse( q{<!-- comment in doc --><doc id="doc"></doc>});
30
$expected= ' comment in doc ';
36
my $expected= ' comment in doc ';
31
37
if( $result eq $expected)
32
38
{ print "ok 2\n"; }
34
40
{ print "not ok 2\n";
35
41
warn "expected: $expected\nfound : $result\n";
39
$t= XML::Twig->new( twig_handlers => { 'doc' => sub { $result= $_->{extra_data}; } },);
47
my $t= XML::Twig->new( twig_handlers => { 'doc' => sub { $result= $_->{extra_data}; } },);
40
48
$t->parse( q{<!-- comment in doc --><doc id="doc"></doc>});
41
$expected= '<!-- comment in doc -->';
49
my $expected= '<!-- comment in doc -->';
42
50
if( $result eq $expected)
43
51
{ print "ok 3\n"; }
45
53
{ print "not ok 3\n";
46
54
warn "expected: $expected\nfound : $result\n";
51
$t= XML::Twig->new( comments => 'process',
52
twig_roots => { '/#COMMENT' => sub { $result= $_->{extra_data}; },
60
my $t= XML::Twig->new( comments => 'process',
61
twig_roots => { '/#COMMENT' => sub { $result= $_->{extra_data}; },
55
64
$t->parse( q{<!-- comment in doc --><doc id="doc"><elt/></doc>});
56
$expected= ''; # This is a bug!
65
my $expected= ''; # This is a bug!
57
66
if( $result eq $expected)
58
67
{ print "ok 4\n"; }
60
69
{ print "not ok 4\n";
61
70
warn "expected: $expected\nfound : $result\n";