Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test that all statement modifiers are terminators
  • Loading branch information
TimToady committed Oct 8, 2015
1 parent 1f0d061 commit 6fa03d9
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 8 deletions.
7 changes: 6 additions & 1 deletion S04-statement-modifiers/for.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 28;
plan 29;

# L<S04/"Conditional statements"/Conditional statement modifiers work as in Perl 5>

Expand Down Expand Up @@ -158,4 +158,9 @@ is ((sub r { "OH HAI" })() for 5), "OH HAI", 'Anon sub in statement modifier for
is ($_ for $[1,2,3]).elems, 1, "does for modifier respect itemization";
}

# RT #79174
{
is (1,2, for 3,4), "1 2 1 2", "for is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/given.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 11;
plan 12;

# L<S04/"Conditional statements"/Conditional statement modifiers work as in Perl 5>

Expand Down Expand Up @@ -75,4 +75,9 @@ plan 11;
is @a, (0, 0, 1, 1), 'given thunk does not mess up statement modifier closures';
}

# RT #79174
{
is (1,2, given 3), "1 2", "given is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/if.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 13;
plan 14;

# L<S04/"Conditional statements"/Conditional statement modifiers work as in Perl 5>

Expand Down Expand Up @@ -85,4 +85,9 @@ plan 13;
is $a, 100, 'Statement-modifier if runs block with placeholder';
}

# RT #79174
{
is (1,2, if 3), "1 2", "if is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/unless.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 8;
plan 9;

# test the unless statement modifier

Expand Down Expand Up @@ -50,4 +50,9 @@ plan 8;
is $a, 0, 'Statement-modifier unless runs block with placeholder';
}

# RT #79174
{
is (1,2, unless 0), "1 2", "unless is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/until.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 4;
plan 5;

# L<S04/"Conditional statements"/Conditional statement modifiers work as in Perl 5>

Expand Down Expand Up @@ -35,4 +35,9 @@ plan 4;
is($a, 2, "post until");
}

# RT #79174
{
eval-lives-ok '1,2, until $++', "until is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/while.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 5;
plan 6;

# L<S04/"Conditional statements"/Conditional statement modifiers work as in Perl 5>

Expand Down Expand Up @@ -42,4 +42,9 @@ plan 5;
is($a, 3, "post while");
}

# RT #79174
{
eval-lives-ok '1,2, while $++ < 1', "while is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/with.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 34;
plan 35;

# Test the topical aspects of the with statement modifier

Expand Down Expand Up @@ -207,4 +207,9 @@ plan 34;
is @x, '(Failure)', 'without/for list comprehension works with parens';
}

# RT #79174
{
is (1,2, with 3), "1 2", "with is a terminator even after comma";
}

# vim: ft=perl6
7 changes: 6 additions & 1 deletion S04-statement-modifiers/without.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 8;
plan 9;

# test the unless statement modifier

Expand Down Expand Up @@ -54,4 +54,9 @@ plan 8;
is $a.WHAT, Failure, 'Statement-modifier without runs block with placeholder';
}

# RT #79174
{
is (1,2, without Nil), "1 2", "without is a terminator even after comma";
}

# vim: ft=perl6

0 comments on commit 6fa03d9

Please sign in to comment.