Debian Codegraph @

t/62overload.t

raw
1 # -*- cperl -*-
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 12;
7
8 use XML::LibXML;
9
10 my $e1 = XML::LibXML::Element->new('test1');
11 $e1->setAttribute('attr' => 'value1');
12
13 my $e2 = XML::LibXML::Element->new('test2');
14 $e2->setAttribute('attr' => 'value2');
15
16 my $h1 = \%{ $e1 };
17 my $h2 = \%{ $e2 };
18
19 isnt $h1,$h2, 'different references';
20
21 is $h1->{attr}, 'value1', 'affr for el 1';
22 is $h2->{attr}, 'value2', 'affr for el 2';
23
24 is "$e1", '<test1 attr="value1"/>', 'stringify for el 1';
25 is "$e2", '<test2 attr="value2"/>', 'stringify for el 2';
26
27 cmp_ok 0+$e1, '>', 1, 'num for el 1';
28 cmp_ok 0+$e2, '>', 1, 'num for el 2';
29
30 isnt 0+$e1,0+$e2, 'num for e1 and e2 differs';
31
32 my $e3 = $e1;
33
34 ok $e3 eq $e1, 'eq';
35 ok $e3 == $e1, '==';
36
37 ok $e1 ne $e2, 'ne';
38 ok $e1 != $e2, '!=';