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