File: 62overload.t

package info (click to toggle)
libxml-libxml-perl 2.0116%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,420 kB
  • sloc: perl: 6,139; ansic: 3,752; xml: 182; sh: 64; makefile: 8
file content (38 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- cperl -*-

use strict;
use warnings;

use Test::More tests => 12;

use XML::LibXML;

my $e1 = XML::LibXML::Element->new('test1');
$e1->setAttribute('attr' => 'value1');

my $e2 = XML::LibXML::Element->new('test2');
$e2->setAttribute('attr' => 'value2');

my $h1 = \%{ $e1 };
my $h2 = \%{ $e2 };

isnt $h1,$h2, 'different references';

is $h1->{attr}, 'value1', 'affr for el 1';
is $h2->{attr}, 'value2', 'affr for el 2';

is "$e1", '<test1 attr="value1"/>', 'stringify for el 1';
is "$e2", '<test2 attr="value2"/>', 'stringify for el 2';

cmp_ok 0+$e1, '>', 1, 'num for el 1';
cmp_ok 0+$e2, '>', 1, 'num for el 2';

isnt 0+$e1,0+$e2, 'num for e1 and e2 differs';

my $e3 = $e1;

ok $e3 eq $e1, 'eq';
ok $e3 == $e1, '==';

ok $e1 ne $e2, 'ne';
ok $e1 != $e2, '!=';