Skip to content

Commit aaab8c2

Browse files
committed
Merge branch 'master' of git://github.com/perl6/roast
2 parents ed219b0 + 26a959e commit aaab8c2

File tree

9 files changed

+92
-17
lines changed

9 files changed

+92
-17
lines changed

S02-literals/string-interpolation.t

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use v6;
22
use Test;
3-
plan 12;
3+
plan 13;
44

55
# L<S02/Closures/"A bare closure also interpolates in double-quotish context.">
66

@@ -50,4 +50,10 @@ line 4
5050
is +''.new, 0, '... and that strinig works normally';
5151
}
5252

53+
# RT #79568
54+
{
55+
my $w = 'work';
56+
is "this should $w\</a>", 'this should work</a>', 'backslash after scalar';
57+
}
58+
5359
# vim: ft=perl6

S02-types/autovivification.t

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 10;
5+
plan 12;
66

77
# L<S09/Autovivification/In Perl 6 these read-only operations are indeed non-destructive:>
88
{
@@ -67,4 +67,14 @@ sub foo ($baz is rw) { #OK not used
6767
# readonly signature, should it autovivify?
6868
sub bar ($baz is readonly) { } #OK not used
6969

70+
# RT #77038
71+
#?niecza skip "Unable to resolve method push in type Any"
72+
{
73+
my %h;
74+
push %h<a>, 4, 2;
75+
is %h<a>.join, '42', 'can autovivify in sub form of push';
76+
unshift %h<b>, 5, 3;
77+
is %h<b>.join, '53', 'can autovivify in sub form of unshift';
78+
}
79+
7080
# vim: ft=perl6

S03-binding/scalars.t

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ These tests are derived from the "Item assignment precedence" section of Synopsi
1111
1212
=end head1
1313

14-
plan 32;
14+
plan 33;
1515

1616
# Basic scalar binding tests
1717
{
@@ -164,4 +164,12 @@ eval_dies_ok '0 := 1', 'cannot bind to a literal';
164164
is $x, 5, 'interaction between signature binding and ordinary binding';
165165
}
166166

167+
# RT #87034
168+
{
169+
my $x = 1;
170+
my $y := $x;
171+
$x := 3;
172+
is $y, 1, 'rebinding';
173+
}
174+
167175
# vim: ft=perl6

S03-sequence/misc.t

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use Test;
44

55
# L<S03/List infix precedence/constraints implied by the signature of the function>
66
#?niecza skip 'Nominal type check failed in binding Int $n in f; got Str, needed Int'
7+
#?rakudo skip 'type check failed (bogus test?)'
78
{
89
sub f (Int $n) { $n > 3 ?? 'liftoff!' !! $n + 1 }
910
is (1, &f ... *).join(' '), '1 2 3 liftoff!', 'sequence terminated by signature mismatch';
@@ -19,9 +20,10 @@ is (() ... *)[^3].perl, '((), (), ())', 'Nil sequence';
1920
# L<S03/List infix precedence/interleave unrelated sequences>
2021
# multiple return values
2122

22-
is (1, 1, { $^a + 1, $^b * 2 } ... *)[^12].join(' '), '1 1 2 2 3 4 4 8 5 16 6 32', 'sequence of two interleaved sequences';
23-
is (1, 1, 1, { $^a + 1, $^b * 2, $^c - 1 } ... *)[^18].join(' '), '1 1 1 2 2 0 3 4 -1 4 8 -2 5 16 -3 6 32 -4', 'sequence of three interleaved sequences';
23+
is (1, 1, { $^a + 1, $^b * 2 } ... *).flat.[^12].join(' '), '1 1 2 2 3 4 4 8 5 16 6 32', 'sequence of two interleaved sequences';
24+
is (1, 1, 1, { $^a + 1, $^b * 2, $^c - 1 } ... *).flat.[^18].join(' '), '1 1 1 2 2 0 3 4 -1 4 8 -2 5 16 -3 6 32 -4', 'sequence of three interleaved sequences';
2425
is (1, { $^n + 1 xx $^n + 1 } ... *)[^10].join(' '), '1 2 2 3 3 3 4 4 4 4', 'sequence with list-returning block';
26+
#?rakudo 2 todo 'NYI'
2527
is ('a', 'b', { $^a ~ 'x', $^a ~ $^b, $^b ~ 'y' } ... *)[^11].join(' '), 'a b ax ab by abx abby byy abbyx abbybyy byyy', 'sequence with arity < number of return values';
2628
is ('a', 'b', 'c', { $^x ~ 'x', $^y ~ 'y' ~ $^z ~ 'z' } ... *)[^9].join(' '), 'a b c ax bycz cx axybyczz byczx cxyaxybyczzz', 'sequence with arity > number of return values';
2729

@@ -31,8 +33,8 @@ eval_dies_ok '(1, 2, ... 3)[2]', 'yada operator not confused for sequence operat
3133

3234
# L<S03/List infix precedence/and another function to continue the list>
3335
# chained sequence
34-
#?rakudo emit skip_rest 'chained sequence NYI';
3536

37+
#?rakudo 8 skip 'chained sequence NYI'
3638
is (1 ... 5 ... 10).join(' '),
3739
'1 2 3 4 5 6 7 8 9 10',
3840
'simple chained finite arithmetic sequence';
@@ -72,10 +74,12 @@ is (1, 4, 7 ... 16, 16 ... *)[^8].join(' '),
7274
# 'chained arithmetic sequence with exclusion';
7375

7476
#?niecza skip 'Cannot use value like Block as a number'
77+
#?rakudo skip 'chained sequences NYI'
7578
is (1, *+1 ... { $_ < 5 }, 5, *+10 ... { $_ < 35 }, 35, *+100 ... { $_ < 400 }).join(' '),
7679
'1 2 3 4 5 15 25 35 135 235 335',
7780
'simple chained sequence with closures';
7881
#?niecza skip 'Unable to resolve method chars in class Block'
82+
#?rakudo skip 'chained sequences NYI'
7983
is (1, { $^n*2 + 1 } ... 31, *+5 ... { $^n**2 < 2000 }, 'a', *~'z' ... { $_.chars < 6 }).join(' '),
8084
'1 3 7 15 31 36 41 a az azz azzz azzzz',
8185
'chained sequence with closures';

S04-statements/return.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use v6;
22
use Test;
3-
plan 15;
3+
plan 17;
44

55
# Is there a better reference for the spec for how return return works?
66
# There is "return function" but that's a more advanced feature.
@@ -53,4 +53,19 @@ is( try { sub foo { my $x = 1; while $x-- { return 24; }; return 42; }; foo() },
5353
is($bar, '42 1', 'Should not return empty string');
5454
}
5555

56+
# RT #81962
57+
{
58+
my $tracker = '';
59+
my &r = &return;
60+
sub f {
61+
my &return := -> $v {
62+
$tracker ~= 'LOL';
63+
&r($v * 2);
64+
};
65+
return(21);
66+
}
67+
is f(), 42, 'proxied return produces the correct value';
68+
is $tracker, 'LOL', 'proxied return produced the right side effect';
69+
}
70+
5671
# vim: ft=perl6

S05-mass/rx.t

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,6 @@ eval_dies_ok '/\X[/', 'unterminated \X[..]';
28452845
eval_dies_ok '/* abc/', 'bare * at start';
28462846

28472847
#### * abc abcdef /Quantifier follows nothing/ bare * after ws
2848-
#?niecza todo ""
28492848
#?pugs todo
28502849
eval_dies_ok '/ * abc/', 'bare * after ws';
28512850

@@ -2854,7 +2853,6 @@ eval_dies_ok '/ * abc/', 'bare * after ws';
28542853
eval_dies_ok '/[*|a]/', 'bare * after [';
28552854

28562855
#### [ *|a] abcdef /Quantifier follows nothing/ bare * after [+sp
2857-
#?niecza todo ""
28582856
#?pugs todo
28592857
eval_dies_ok '/[ *|a]/', 'bare * after [+sp';
28602858

@@ -2863,7 +2861,6 @@ eval_dies_ok '/[ *|a]/', 'bare * after [+sp';
28632861
eval_dies_ok '/[a|*]/', 'bare * after |';
28642862

28652863
#### [a| *] abcdef /Quantifier follows nothing/ bare * after |+sp
2866-
#?niecza todo ""
28672864
#?pugs todo
28682865
eval_dies_ok '/[a| *]/', 'bare * after |+sp';
28692866

@@ -2873,7 +2870,6 @@ eval_dies_ok '/[a| *]/', 'bare * after |+sp';
28732870
eval_dies_ok '/+ abc/', 'bare + at start';
28742871

28752872
#### + abc abcdef /Quantifier follows nothing/ bare + after ws
2876-
#?niecza todo ""
28772873
#?pugs todo
28782874
eval_dies_ok '/ + abc/', 'bare + after ws';
28792875

@@ -2882,7 +2878,6 @@ eval_dies_ok '/ + abc/', 'bare + after ws';
28822878
eval_dies_ok '/[+|a]/', 'bare + after [';
28832879

28842880
#### [ +|a] abcdef /Quantifier follows nothing/ bare + after [+sp
2885-
#?niecza todo ""
28862881
#?pugs todo
28872882
eval_dies_ok '/[ +|a]/', 'bare + after [+sp';
28882883

@@ -2891,7 +2886,6 @@ eval_dies_ok '/[ +|a]/', 'bare + after [+sp';
28912886
eval_dies_ok '/[a|+]/', 'bare + after |';
28922887

28932888
#### [a| +] abcdef /Quantifier follows nothing/ bare + after |+sp
2894-
#?niecza todo ""
28952889
#?pugs todo
28962890
eval_dies_ok '/[a| +]/', 'bare + after |+sp';
28972891

@@ -2901,7 +2895,6 @@ eval_dies_ok '/[a| +]/', 'bare + after |+sp';
29012895
eval_dies_ok '/? abc/', 'bare ? at start';
29022896

29032897
#### ? abc abcdef /Quantifier follows nothing/ bare ? after ws
2904-
#?niecza todo ""
29052898
#?pugs todo
29062899
eval_dies_ok '/ ? abc/', 'bare ? after ws';
29072900

@@ -2910,7 +2903,6 @@ eval_dies_ok '/ ? abc/', 'bare ? after ws';
29102903
eval_dies_ok '/[?|a]/', 'bare ? after [';
29112904

29122905
#### [ ?|a] abcdef /Quantifier follows nothing/ bare ? after [+sp
2913-
#?niecza todo ""
29142906
#?pugs todo
29152907
eval_dies_ok '/[ ?|a]/', 'bare ? after [+sp';
29162908

@@ -2919,7 +2911,6 @@ eval_dies_ok '/[ ?|a]/', 'bare ? after [+sp';
29192911
eval_dies_ok '/[a|?]/', 'bare ? after |';
29202912

29212913
#### [a| ?] abcdef /Quantifier follows nothing/ bare ? after |+sp
2922-
#?niecza todo ""
29232914
#?pugs todo
29242915
eval_dies_ok '/[a| ?]/', 'bare ? after |+sp';
29252916

S05-metasyntax/angle-brackets.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ character classes), and those are referenced at the correct spot.
209209
# A leading ?{ or !{ indicates a code assertion
210210
{
211211
ok('192' ~~ /(\d**3) <?{$0 < 256}>/, '<?{...}> works');
212-
#?niecza todo '<?{...}>'
213212
ok(!('992' ~~ /(\d**3) <?{$0 < 256}>/), '<?{...}> works');
214213
ok(!('192' ~~ /(\d**3) <!{$0 < 256}>/), '<!{...}> works');
215214
ok('992' ~~ /(\d**3) <!{$0 < 256}>/, '<!{...}> works');

S05-metasyntax/proto-token-ltm.t

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use v6;
2+
use Test;
3+
4+
plan 10;
5+
6+
grammar LTM2 {
7+
proto token TOP {*}
8+
token TOP:sym<a> { 'aa' }
9+
token TOP:sym<x> { 'ab' }
10+
token TOP:sym<y> { 'ac' }
11+
token TOP:sym<z> { 'a' | 'i' | 'j' }
12+
token TOP:sym<b> { a**4 }
13+
token TOP:sym<c> { a**2 % c }
14+
token TOP:sym<d> { a**3..3 % d }
15+
token TOP:sym<e> { a**1..* % e }
16+
token TOP:sym<f> { afafafa? %% f }
17+
token TOP:sym<g> { agagagaga? % g } # last g is never tried
18+
token TOP:sym<h> {
19+
ahahahahaha+ % h }
20+
token TOP:sym<i> { i**5..6
21+
}
22+
token TOP:sym<j> {
23+
j**7..* }
24+
}
25+
26+
is ~LTM2.parse('aaaaaaaa'), 'aaaa', 'LTM a**4 worked';
27+
is ~LTM2.parse('acacaca'), 'aca', 'LTM a**2 % c worked';
28+
is ~LTM2.parse('adadadadada'), 'adada', 'LTM a**3..3 % d worked';
29+
is ~LTM2.parse('aeaeaea'), 'aeaeaea', 'LTM a**1..* % e worked';
30+
is ~LTM2.parse('afafafafafafa'), 'afafafaf', 'LTM afafafa? %% f worked';
31+
is ~LTM2.parse('agagagagagagaga'), 'agagagaga', 'LTM agaagaga? % g worked';
32+
is ~LTM2.parse('ahahahahahahahaha'), 'ahahahahahahahaha', 'LTM ahaahahaha+ % h worked';
33+
isnt LTM2.parse('ahahahahah'), 'ahahahaha', 'LTM ahahahahaha+ % h~failed correctly';
34+
is ~LTM2.parse('iiiiii'), 'iiiiii', 'LTM i**5..6 worked';
35+
is ~LTM2.parse('jjjjjjjjjj'), 'jjjjjjjjjj', 'LTM j**7..* worked';

S32-exceptions/misc.t

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ throws_like 'sub (Int Str $x) { }', X::Parameter::MultipleTypeConstraints;
7878
# even if the tests look rather boring;
7979
throws_like 'my @a; my @a', X::Redeclaration, symbol => '@a';
8080
throws_like 'sub a { }; sub a { }',X::Redeclaration, symbol => 'a', what => 'routine';
81+
# RT #78370
82+
#?rakudo skip 'RT 78370'
83+
throws_like 'my &a; multi a { }', X::Redeclaration, symbol => 'a', what => 'routine';
8184
throws_like 'sub a { }; multi sub a { }',X::Redeclaration, symbol => 'a', what => 'routine';
8285
throws_like 'my class A { }; my class A { }', X::Redeclaration, symbol => 'A';
8386
throws_like 'my class B { }; my subset B of Any;', X::Redeclaration, symbol => 'B';
@@ -124,6 +127,8 @@ throws_like '@a', X::Undeclared, symbol => '@a';
124127
throws_like 'augment class Any { }', X::Syntax::Augment::WithoutMonkeyTyping;
125128
throws_like 'use MONKEY_TYPING; augment role Positional { }', X::Syntax::Augment::Role;
126129
throws_like 'sub postbla:sym<foo>() { }', X::Syntax::Extension::Category, category => 'postbla';
130+
# RT #83992
131+
throws_like 'my @a = 1, => 2', X::Syntax::InfixInTermPosition, infix => '=>';
127132
throws_like 'sub f(:in(:$in)) { }', X::Signature::NameClash, name => 'in';
128133
throws_like 'my $foo does &Int', X::Does::TypeObject;
129134
throws_like 'my $foo does &Int, &Bool', X::Does::TypeObject;
@@ -258,4 +263,6 @@ throws_like '<a b> »+« <c>', X::HyperOp::NonDWIM,
258263
throws_like '<a b> »+« <c>', X::HyperOp::NonDWIM,
259264
left-elems => 2, right-elems => 1;
260265

266+
throws_like 'my sub f() { gather { return } }; ~f()', X::ControlFlow::Return;
267+
261268
done;

0 commit comments

Comments
 (0)