File: 00-aux.t

package info (click to toggle)
libxml-tmx-perl 0.39-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 1,712; xml: 115; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,234 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl

use XML::TMX::Reader;
use Test::More;

is_deeply(XML::TMX::Reader::_merge_notes(undef, "foo"), ["foo"]);
is_deeply(XML::TMX::Reader::_merge_notes(undef, ["foo"]), ["foo"]);
is_deeply(XML::TMX::Reader::_merge_notes([], ["foo"]), ["foo"]);
is_deeply(XML::TMX::Reader::_merge_notes("foo","foo"), ["foo"]);

is_deeply([ sort @{ XML::TMX::Reader::_merge_notes("foo", ["foo", "bar"]) }],
          [ sort (qw'foo bar') ]);

is_deeply([ sort @{ XML::TMX::Reader::_merge_notes([qw'a b c e'], [qw'c d e f']) }],
          [ sort (qw'a b c d e f') ]);

is_deeply(XML::TMX::Reader::_merge_props(undef, {foo => 'bar'}), {foo=>['bar']});

is_deeply(XML::TMX::Reader::_merge_props({foo => 'bar'}, {foo => 'bar'}),
          {foo=>['bar']});

my $m = XML::TMX::Reader::_merge_props({foo => 'ugh'}, {foo => 'bar'});
ok exists $m->{foo};
is_deeply [ sort @{$m->{foo}} ], [sort(qw'bar ugh')];

is_deeply(XML::TMX::Reader::_merge_props({foz => 'bar'}, {foo => 'bar'}),
          {foz=>'bar', foo=>['bar']});

$m = XML::TMX::Reader::_merge_props({foz => 'bar'}, {foz => 'baz', foo => 'bar'});
ok exists $m->{foo};
ok exists $m->{foz};
is_deeply [ sort @{$m->{foz}} ], [sort(qw'bar baz')];
is_deeply $m->{foo}, ['bar'];


done_testing();