86
86
{ eval {XML::Twig->new( keep_spaces => 1, discard_spaces => 1 )};
87
matches( $@, "cannot use both keep_spaces and discard_spaces", "invalid option combination 1");
87
matches( $@, "cannot use both keep_spaces and discard_spaces", "invalid option combination keep_spaces and discard_spaces");
88
eval {XML::Twig->new( keep_spaces => 1, discard_all_spaces => 1 )};
89
matches( $@, "cannot use both keep_spaces and discard_all_spaces", "invalid option combination keep_spaces and discard_all_spaces");
88
90
eval {XML::Twig->new( keep_spaces => 1, keep_spaces_in => ['p'])};
89
matches( $@, "cannot use both keep_spaces and keep_spaces_in", "invalid option combination 2");
91
matches( $@, "cannot use both keep_spaces and keep_spaces_in", "invalid option combination keep_spaces and keep_spaces_in");
92
eval {XML::Twig->new( discard_spaces => 1, discard_all_spaces => 1)};
93
matches( $@, "cannot use both discard_spaces and discard_all_spaces", "invalid option combination discard_spaces and discard_all_spaces");
90
94
eval {XML::Twig->new( discard_spaces => 1, keep_spaces_in => ['p'])};
91
matches( $@, "cannot use both discard_spaces and keep_spaces_in", "invalid option combination 3");
95
matches( $@, "cannot use both discard_spaces and keep_spaces_in", "invalid option combination discard_spaces and keep_spaces_in");
92
96
eval {XML::Twig->new( keep_spaces_in => [ 'doc' ], discard_spaces_in => ['p'])};
93
matches( $@, "cannot use both keep_spaces_in and discard_spaces_in", "invalid option combination 4");
97
matches( $@, "cannot use both keep_spaces_in and discard_spaces_in", "invalid option combination keep_spaces_in and discard_spaces_in");
98
eval {XML::Twig->new( discard_spaces => 1, discard_spaces_in => ['p'])};
99
matches( $@, "cannot use both discard_spaces and discard_spaces_in", "invalid option combination discard_spaces and discard_spaces_in");
100
eval {XML::Twig->new( keep_spaces_in => [ 'doc' ], discard_all_spaces => 1)};
101
matches( $@, "cannot use both keep_spaces_in and discard_all_spaces", "invalid option combination keep_spaces_in and discard_all_spaces");
102
eval {XML::Twig->new( discard_all_spaces => 1, discard_spaces_in => ['p'])};
103
matches( $@, "cannot use both discard_all_spaces and discard_spaces_in", "invalid option combination discard_all_spaces and discard_spaces_in");
94
104
eval {XML::Twig->new( comments => 'wrong') };
95
105
matches( $@, "wrong value for comments argument: 'wrong'", "invalid option value for comment");
96
106
eval {XML::Twig->new( pi => 'wrong') };
97
107
matches( $@, "wrong value for pi argument: 'wrong'", "invalid option value for pi");
100
111
{ my $t=XML::Twig->new->parse( '<doc><p> p1</p><p>p 2</p></doc>');
153
{ my $t= XML::Twig->new->parse( '<doc/>');
154
eval { XML::Twig->parse( twig_handlers => { q{foo[@a="$sd"]} => sub { } }, "<foo/>"); };
155
matches( $@, "^wrong handler condition", 'perl syntax in attribute value');
142
158
{ my $t= XML::Twig->new->parse( '<doc><field/></doc>');
143
159
eval { $t->root->set_field( '*[2]'); };
144
160
matches( $@, "can't create a field name from", 'set_field');
325
{ my $e1= XML::Twig::Elt->new( 'foo');
326
my $e2= XML::Twig::Elt->new( 'foo');
328
eval { $e1->paste_before( $e2); };
329
matches( $@, "cannot paste before an orphan element", 'paste before an orphan element' );
331
eval { $e1->paste_after( $e2); };
332
matches( $@, "cannot paste after an orphan element", 'paste after an orphan element' );
335
{ my $r= XML::Twig->parse( '<doc/>')->root;
336
eval { $r->find_nodes( '//foo/following::') };
337
matches( $@, "error in xpath expression", 'error in xpath expression');
311
342
sub can_check_for_pipes