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