File: set_init.t

package info (click to toggle)
libset-tiny-perl 0.04-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 120 kB
  • ctags: 26
  • sloc: perl: 363; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl
use strict;

use Test::More tests => 7;

# test to make sure that the short initializer (`set()`) works

use_ok 'Set::Tiny', qw(set);

my $a = set();
my $b = set(qw( a b c ));

isa_ok $a, 'Set::Tiny';
isa_ok $b, 'Set::Tiny';

is $a->as_string, '()', "empty set stringification";
is $b->as_string, '(a b c)', "non-empty set stringification";

my $c = set(['a', 'b', 'c']);
is $c->as_string, '(a b c)', "initializer can be called with arrayref";

my $d = set($c);
is $d->as_string, '(a b c)', "initializer can be called on existing set";