File: set_init.t

package info (click to toggle)
libset-tiny-perl 0.02-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 108 kB
  • sloc: perl: 348; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use strict;

use Test::More tests => 6;

# 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";