Skip to content

Commit

Permalink
Add test for the extended alternative forms of 42.:<->
Browse files Browse the repository at this point in the history
This commit add more in depth testing of issue Rakudo/#2094 on GitHub.
In particular, it checks support of 42.:['-'], 42.:«"-"» and similar
forms.

This commit also switches to eval-lives-ok from just ok to fail
elegantly instead of crashing when the implementation does not support
these alternative forms.
  • Loading branch information
ribbon-otter committed Aug 26, 2018
1 parent fe7cdb2 commit 4947054
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions S02-literals/numeric.t
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ ok 0e999999999999999 == 0, '0e999999999999 equals zero';

# https://github.com/rakudo/rakudo/issues/2094
subtest '#2094 prefix as post fix works on number literals' => {
plan 2;
ok 42.:<-> == -42, 'use negation as postfix';
ok 42.:<~> === "42", 'use ~ as postfix';
plan 6;
eval-lives-ok q{42.:<-> == -42}, 'use negation as postfix';
eval-lives-ok q{42.:<~> === "42"}, 'use ~ as postfix';
eval-lives-ok q{42.:«~» === "42"}, 'use « » to wrap the prefix';
eval-lives-ok q{42.:<<~>> === "42"}, 'use << >> to wrap the prefix';
eval-lives-ok q{42.:["~"] === "42"}, 'use [" "] to wrap the prefix';
eval-lives-ok q{42.:<<'~'>> === "42"}, "use <<' '>> to wrap the prefix";
}
# vim: ft=perl6 sw=4 ts=4 expandtab

0 comments on commit 4947054

Please sign in to comment.