File: custom_display.t

package info (click to toggle)
libset-object-perl 1.42-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 620 kB
  • sloc: perl: 1,069; makefile: 14
file content (38 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (9)
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

use Set::Object;
print "1..7\n";

$a = Set::Object->new("a".."e");
$b = Set::Object->new("a".."e");

print "not " unless $a eq "Set::Object(a b c d e)";
print "ok 1 # $a\n";

my $cb = Set::Object->as_string_callback;

Set::Object->as_string_callback(sub{join(",",sort shift->elements)});

print "not " unless $a eq "a,b,c,d,e";
print "ok 2 # $a\n";

$b->as_string_callback(sub{join("-",sort shift->elements)});

print "not " unless $b eq "a-b-c-d-e";
print "ok 3 # $b\n";

#print "not " unless $a eq "a,b,c,d,e";
print "ok 4 # Skip misplaced functionality\n";

Set::Object->as_string_callback($cb);

print "not " unless "$a" eq "Set::Object(a b c d e)";
print "ok 5 # $a\n";

#print "not " unless $b eq "a-b-c-d-e";
print "ok 6 # Skip misplaced functionality\n";

$b->as_string_callback(undef);

print "not " unless $b eq "Set::Object(a b c d e)";
print "ok 7 # $b\n";