Skip to content

Commit

Permalink
Also test ?? foo : bar
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Apr 17, 2015
1 parent 6f2fc2d commit e0741e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion S03-operators/ternary.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Test;

#Ternary operator ?? !!

plan 21;
plan 22;
#L<S03/Changes to Perl 5 operators/"The ? : conditional operator becomes ?? !!">

my $str1 = "aaa";
Expand Down Expand Up @@ -74,8 +74,14 @@ eval_dies_ok q[ 71704 !! 'bust' ], 'Ternary error (RT 71704)';

throws_like { EVAL '1 ?? 3 :: 2' },
X::Syntax::ConditionalOperator::SecondPartInvalid,
second-part => "::",
'conditional operator written as ?? :: throws typed exception';

throws_like { EVAL '1 ?? 3 : 2' },
X::Syntax::ConditionalOperator::SecondPartInvalid,
second-part => ":",
'conditional operator written as ?? : throws typed exception';

throws_like { EVAL '1 ?? b\n !! 2' },
X::Syntax::Confused,
'bogus code before !! of conditional operator is compile time error';
Expand Down

0 comments on commit e0741e9

Please sign in to comment.