File: 41structures.t

package info (click to toggle)
libxs-parse-keyword-perl 0.48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: ansic: 2,037; perl: 1,013; sh: 6; makefile: 3
file content (50 lines) | stat: -rw-r--r-- 980 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use lib "t";
use testcase "t::structures";

BEGIN { $^H{"t::structures/permit"} = 1; }

# sequence
{
   is( structsequence part 123, 123, 'sequence' );
}

# optional
{
   is( structoptional part, 1, 'optional present' );
   is( structoptional,      0, 'optional absent' );
}

# repeated
{
   is( structrepeat part part, 2, 'repeated twice' );
   is( structrepeat part part part part, 4, 'repeated four times' );
}

# choice
{
   is( structchoice zero, 0, 'choice zero' );
   is( structchoice two, 2, 'choice two' );
   is( structchoice { 1234 }, 3, 'choice block' ); # RT136845
   is( structchoice, -1, 'choice absent' );
}

# tagged choice
{
   is( structtagged one, 1, 'tagged choice one' );
   is( structtagged three, 3, 'tagged choice three' );
}

# comma list
{
   is( (structcommalist item), 1, 'comma list with 1 item' );
   is( (structcommalist item, item, item), 3, 'comma list with 3 items' );
}

done_testing;