| 1 |
#!/usr/bin/perl -w |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use XML::LibXML; |
| 5 |
use Test::More tests => 7; |
| 6 |
|
| 7 |
# tests for bug #24953: External entities not expanded in included file (XInclude) |
| 8 |
|
| 9 |
my $parser = XML::LibXML->new; |
| 10 |
my $file = 'test/xinclude/test.xml'; |
| 11 |
{ |
| 12 |
$parser->expand_xinclude(0); |
| 13 |
$parser->expand_entities(1); |
| 14 |
# TEST |
| 15 |
ok (scalar ($parser->parse_file($file)->toString() !~ /IT WORKS/), ' TODO : Add test name'); |
| 16 |
} |
| 17 |
{ |
| 18 |
$parser->expand_xinclude(1); |
| 19 |
$parser->expand_entities(0); |
| 20 |
# TEST |
| 21 |
ok (scalar($parser->parse_file($file)->toString() !~ /IT WORKS/), ' TODO : Add test name'); |
| 22 |
} |
| 23 |
{ |
| 24 |
$parser->expand_xinclude(1); |
| 25 |
$parser->expand_entities(1); |
| 26 |
# TEST |
| 27 |
ok (scalar($parser->parse_file($file)->toString() =~ /IT WORKS/), ' TODO : Add test name'); |
| 28 |
} |
| 29 |
{ |
| 30 |
$parser->expand_xinclude(0); |
| 31 |
my $doc = $parser->parse_file($file); |
| 32 |
# TEST |
| 33 |
ok( $doc->process_xinclude({expand_entities=>0}), ' TODO : Add test name' ); |
| 34 |
# TEST |
| 35 |
ok( scalar($doc->toString() !~ /IT WORKS/), ' TODO : Add test name' ); |
| 36 |
} |
| 37 |
{ |
| 38 |
my $doc = $parser->parse_file($file); |
| 39 |
# TEST |
| 40 |
ok( $doc->process_xinclude({expand_entities=>1}), ' TODO : Add test name' ); |
| 41 |
# TEST |
| 42 |
ok( scalar($doc->toString() =~ /IT WORKS/), ' TODO : Add test name' ); |
| 43 |
} |