Debian Codegraph @

t/41structures.t

raw
1 #!/usr/bin/perl
2
3 use v5.14;
4 use warnings;
5
6 use Test2::V0;
7
8 use lib "t";
9 use testcase "t::structures";
10
11 BEGIN { $^H{"t::structures/permit"} = 1; }
12
13 # sequence
14 {
15 is( structsequence part 123, 123, 'sequence' );
16 }
17
18 # optional
19 {
20 is( structoptional part, 1, 'optional present' );
21 is( structoptional, 0, 'optional absent' );
22 }
23
24 # repeated
25 {
26 is( structrepeat part part, 2, 'repeated twice' );
27 is( structrepeat part part part part, 4, 'repeated four times' );
28 }
29
30 # choice
31 {
32 is( structchoice zero, 0, 'choice zero' );
33 is( structchoice two, 2, 'choice two' );
34 is( structchoice { 1234 }, 3, 'choice block' ); # RT136845
35 is( structchoice, -1, 'choice absent' );
36 }
37
38 # tagged choice
39 {
40 is( structtagged one, 1, 'tagged choice one' );
41 is( structtagged three, 3, 'tagged choice three' );
42 }
43
44 # comma list
45 {
46 is( (structcommalist item), 1, 'comma list with 1 item' );
47 is( (structcommalist item, item, item), 3, 'comma list with 3 items' );
48 }
49
50 done_testing;