Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t/spec]: Add tests for ($value unless $answer) statement modifier.

git-svn-id: http://svn.pugscode.org/pugs@26088 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit e9b63a4f6d954e49a088c1fafdc71418a45bf471 1 parent 4aabc62
pmichaud authored
Showing with 20 additions and 1 deletion.
  1. +20 −1 S04-statement-modifiers/unless.t
View
21 S04-statement-modifiers/unless.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 2;
+plan 6;
# test the unless statement modifier
@@ -18,3 +18,22 @@ plan 2;
$a = 5 unless 'a' eq 'b';
is($a, 5, "post unless");
}
+
+{
+ my $answer = 1;
+ my @x = 41, (42 unless $answer), 43;
+ my @y = 41, (!$answer ?? 42 !! ()), 43;
+ my @z = 41, 43;
+ is @y, @z, "sanity check";
+ is @x, @y, "unless expr on true cond";
+}
+
+{
+ my $answer = 0;
+ my @x = 41, (42 unless $answer), 43;
+ my @y = 41, (!$answer ?? 42 !! ()), 43;
+ my @z = 41, 42, 43;
+ is @y, @z, "sanity check";
+ is @x, @y, "unless expr on false cond";
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.