Skip to content

Commit

Permalink
Test whatever regex curries
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Feb 2, 2018
1 parent 1f7d29f commit 323a2b6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion S02-types/whatever.t
Expand Up @@ -5,7 +5,7 @@ use lib 't/spec/packages';
use Test;
use Test::Util;

plan 121;
plan 122;

# L<S02/The Whatever Object/"The * character as a standalone term captures the notion of">
# L<S02/Native types/"If any native type is explicitly initialized to">
Expand Down Expand Up @@ -399,4 +399,32 @@ subtest 'compile time WhateverCode evaluation' => {
is (my Foo $b is default(42)), 42, 'subset + default on variable';
}

# RT #131409
subtest 'regex whatever curry' => {
plan 11;
my @a = <foo bar>.map: { * ~~ /<$_>/ }
is @a.head.('foo').so, True, '/<$_>/ curry';

my @b = <foo bar>.map: { * ~~ /<$_> { pass 'in-regex block' }/ }
is @b.head.('foo').so, True, '/<$_>/ curry';

my @c = <foo bar>.map: { * ~~ /<$_> {
pass 'in-regex block';
my &z := { pass 'in block inside in-regex block' }
z
}/ }
is @c.head.('foo').so, True, '/<$_>/ curry';

my @d = <foo bar>.map: { * ~~ /<$_>
<?{ pass 'in <?{...}> block'; True}>
<!{ pass 'in <!{...}> block'; False}>
{
pass 'in-regex block';
my &z := { pass 'in block inside in-regex block' }
z
}
/}
is @d.head.('foo').so, True, '/<$_>/ curry';
}

# vim: ft=perl6

0 comments on commit 323a2b6

Please sign in to comment.