Skip to content

Commit

Permalink
Batch #14 of roast RT -> GH ticket migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 12, 2020
1 parent da0e915 commit 2552970
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 81 deletions.
2 changes: 1 addition & 1 deletion S05-match/blocks.t
Expand Up @@ -13,7 +13,7 @@ kind of block, and in the condition, if any.
=end description

# RT #58306
# https://github.com/Raku/old-issue-tracker/issues/276
if 1 {
ok 'a' ~~ /./, 'Can match in an if block';
is ~$/, 'a', '... and can use the match var';
Expand Down
52 changes: 26 additions & 26 deletions S05-match/capturing-contexts.t
Expand Up @@ -41,7 +41,7 @@ plan 64;
ok( $/.hash.keys[0] eq 'alpha', 'the .hash method returns a hash object');
}

# RT #62530
# https://github.com/Raku/old-issue-tracker/issues/640
{
augment class Match { method keys () {return %(self).keys }; };
my rule a {H};
Expand All @@ -51,7 +51,7 @@ plan 64;
is $x.keys, 'a', 'match copy should be same as match';
}

# RT #64946
# https://github.com/Raku/old-issue-tracker/issues/932
{
my regex o { o };
"foo" ~~ /f<o=&o>+/;
Expand All @@ -64,7 +64,7 @@ plan 64;
is ~$<o>, 'o o', 'match list stringifies like a normal list AFTER "isa"';
}

# RT #64952
# https://github.com/Raku/old-issue-tracker/issues/935
{
'ab' ~~ /(.)+/;
is $/[0][0], 'a', 'match element [0][0] from /(.)+/';
Expand All @@ -75,13 +75,13 @@ plan 64;
is @match[0][1], 'b', 'match element [0][1] from /(.)+/ coerced';
}

# RT #64948
# https://github.com/Raku/old-issue-tracker/issues/933
{
ok %( 'foo' ~~ /<alpha> oo/ )<alpha>:exists,
'Match coerced to Hash says match exists';
}

# RT #70007
# https://github.com/Raku/old-issue-tracker/issues/1378
{
# undefined captures should fail to match
# note the use of $1 (and not $0)
Expand All @@ -90,7 +90,7 @@ plan 64;

# This looks superfluous as there is a test for warning when interpolating
# undefined into a regex in S05-interpolation/regex-in-variable.t
#?rakudo todo 'RT #70007'
#?rakudo todo 'referring to non-existing capture'
is_run( q{'aa' ~~ /(.)$1/},
{
status => 0,
Expand All @@ -100,34 +100,34 @@ plan 64;
'match with undefined capture emits a warning' );
}

# RT #66252
# https://github.com/Raku/old-issue-tracker/issues/1032
{
$_ = 'RT #66252';
$_ = 'Regex match';
m/(R.)/;
isa-ok $/, 'Match', 'Match object in $/ after match in void context';
is $/, 'RT', 'Matched as intended in void context';
is $/, 'Re', 'Matched as intended in void context';
}

# RT #70003
# https://github.com/Raku/old-issue-tracker/issues/1377
{
'abc' ~~ /a/;
is ($/.orig).rindex('a'), 0, 'rindex() works on $/.orig';
is ($/.orig).rindex('a', 2), 0, 'rindex() works on $/.orig';
}

# RT #114726
# https://github.com/Raku/old-issue-tracker/issues/2887
{
lives-ok { my $/ := 42 }, 'can bind $/';
}

# RT #71362
# https://github.com/Raku/old-issue-tracker/issues/1441
{
my $/ := 'foobar';
is $0, 'foobar', '$0 works like $/[0], even for non-Match objects';
nok $1.defined, '$1 is not defined';
}

# RT #72956
# https://github.com/Raku/old-issue-tracker/issues/1527
{
my $/ := Any;
lives-ok { $0 },
Expand All @@ -137,7 +137,7 @@ plan 64;
nok $0.defined, '$0 is undefined';
}

# RT #77160
# https://github.com/Raku/old-issue-tracker/issues/2057
{
ok 'abc' ~~ /(.)+/, 'regex sanity';
my $x = 0;
Expand All @@ -150,7 +150,7 @@ plan 64;
is $x, 2, '$/.list does not flattens subcaptures';
}

# RT #74180
# https://github.com/Raku/old-issue-tracker/issues/1657
{
my $s;
try { $s = EVAL '"foo" ~~ /(foo)/; "$0a"' };
Expand All @@ -160,22 +160,22 @@ plan 64;

# L<S32::Rules/Match>

# RT #117461
# https://github.com/Raku/old-issue-tracker/issues/3097
{
ok "a \n \b \n c \n d" ~~ /a .* c/, "match multiple lines with '.'";
ok $/.can('lines'), "Match has a .lines method";
is +$/.lines, 3, "Correct number of lines";
isa-ok $/, Cool, "Match is Cool";
}

# RT #83508
# https://github.com/Raku/old-issue-tracker/issues/2352
{
'x' ~~ /(y)? (z)*/;
is $0.defined, False, 'quantifier ? matching 0 values returns Nil';
is $1.defined, True, 'quantifier * matching 0 values returns empty list';
}

# RT #125345
# https://github.com/Raku/old-issue-tracker/issues/4304
{
my $*guard = 0;
grammar Foo1 { regex TOP { [a | [ "[" <R> b? "]" ]]+ % b { die if $*guard++ > 500 } }; regex b { b }; regex R { <TOP>+ % [ <.b>? "/" ] } };
Expand All @@ -188,43 +188,43 @@ plan 64;
is Foo2.parse("[abab]").gist, "「[abab]」\n R => 「aba」\n TOP => 「aba」", '(non-)capturing subrules advance cursor position (4)';
}

# RT #126033
# https://github.com/Raku/old-issue-tracker/issues/4530
{
my $a = '<4';
$a = $a ~~ /\<(\d+)/;
is ~$a, '<4', 'result of match assigned to variable matched against works';
}

# RT #118453
# https://github.com/Raku/old-issue-tracker/issues/3163
{
my $rt118453 = 'pre x post';
$rt118453 ~~ /^ (<-[x]>+) 'x' (\N+) $/;
$rt118453 = ~$0;
is ~$1, ' post', 'Reassigning to matched-against string and then accessing submatches works';
}

# RT #125285
# https://github.com/Raku/old-issue-tracker/issues/4279
{
my $m = 'rule1 foo rule2 bar' ~~ /^ ( 'rule1' || 'rule2' )* %% (.+?) $/;
is $m[0].elems, 2, 'Correct number of captures when backtracking (1)';
is $m[1].elems, 2, 'Correct number of captures when backtracking (2)';
}

# RT #116895
# https://github.com/Raku/old-issue-tracker/issues/3056
{
my $m = "abcde" ~~ / (a | b | bc | cde)+»/;
is $m[0].elems, 3, 'LTM alternation does not capture the wrong stuff when backtracking (1)';
is join(" ", $m[0]), 'a b cde', 'LTM alternation does not capture the wrong stuff when backtracking (2)';
}

# RT #127701
# https://github.com/Raku/old-issue-tracker/issues/5174
{
subtest 'postfix operators do not interfere with interpolation of $/[0]', {
plan 3;
'5x3' ~~ /(.)x(.)/;

# fudge reviewed; OK to go into 6.d spec
#?rakudo 3 todo 'RT 127701'
#?rakudo 3 todo 'parse error with --'
is "$/[0]--", '5--', 'postfix --';
is "$/[0]++", '5++', 'postfix ++';

Expand All @@ -233,7 +233,7 @@ plan 64;
}
}

# RT #127075
# https://github.com/Raku/old-issue-tracker/issues/4957
{
lives-ok
{ grammar { token TOP { <número>+ }; token número {<< \d+ >>} } },
Expand All @@ -243,7 +243,7 @@ plan 64;
'non-ascii token in a subcapture work';
}

# RT #129279
# https://github.com/Raku/old-issue-tracker/issues/5676
{
lives-ok
{ "a b" ~~ /(\w) \s (\w)/; my $a = $١ },
Expand Down
4 changes: 2 additions & 2 deletions S05-match/make.t
Expand Up @@ -8,7 +8,7 @@ plan 9;

# L<S05/Match objects/"Fortunately, when you just want to return a different">

# RT #76278
# https://github.com/Raku/old-issue-tracker/issues/1901
"blah foo blah" ~~ / foo # Match 'foo'
{ make 'bar' } # But pretend we matched 'bar'
/;
Expand All @@ -31,7 +31,7 @@ is $/.ast, 'bar', '$/.ast';
cmp-ok $/.ast, '===', FooBar, 'can get made type objects from .ast (2)';
}

# R#2057
# https://github.com/rakudo/rakudo/issues/2057
{
lives-ok { "" ~~ /{ (make 0 for 0) }/ for ^100 },
'check that we did not regress';
Expand Down
2 changes: 1 addition & 1 deletion S05-match/positions.t
Expand Up @@ -33,7 +33,7 @@ is ('abc' ~~ /\d+/), Nil, 'Failed match returns Nil';
is-deeply $/.to, 6, 'List.to';
}

# RT #126249
# https://github.com/Raku/old-issue-tracker/issues/4596
subtest '$/ is constructed in all blocks inside regexes' => {
plan 2;
my @res;
Expand Down
6 changes: 4 additions & 2 deletions S05-match/raku.t
Expand Up @@ -6,7 +6,9 @@ plan 10;

# the simplest tests are just that it lives, which isn't always the case
# for early implementations. In particular there were some Rakudo
# regressions, like RT #63904 and RT #64944
# regressions, like;
# https://github.com/Raku/old-issue-tracker/issues/787
# https://github.com/Raku/old-issue-tracker/issues/931

grammar ExprT1 {
rule TOP { ^ \d+ [ <operator> \d+ ]* }
Expand All @@ -24,7 +26,7 @@ my regex o { o };
ok "foo" ~~ /<f=&f> <o=&o>+ /, 'Regex matches (2)';
lives-ok { $/.raku }, 'lives on quantified named captures';

# RT #64874
# https://github.com/Raku/old-issue-tracker/issues/918
#?rakudo skip '<foo::bar>'
{
my $code_str = 'say <OH HAI>';
Expand Down
6 changes: 3 additions & 3 deletions S12-class/inheritance.t
Expand Up @@ -148,7 +148,7 @@ throws-like 'class RT64642 is ::Nowhere {}', X::Inheritance::UnknownParent,

}

# RT #82814
# https://github.com/Raku/old-issue-tracker/issues/2339
{
my class A {
method new { self.bless }
Expand All @@ -164,7 +164,7 @@ throws-like 'class RT64642 is ::Nowhere {}', X::Inheritance::UnknownParent,
is B.new.c, 42, 'nextsame in constructor works';
}

# RT #75376
# https://github.com/Raku/old-issue-tracker/issues/1789
{
my class RT75376::A { };
lives-ok { our class RT75376::B is RT75376::A { } },
Expand All @@ -173,7 +173,7 @@ throws-like 'class RT64642 is ::Nowhere {}', X::Inheritance::UnknownParent,
'our-scoped class inherited from my-scoped class has proper inheritance hierarchy';
}

# RT #125689
# https://github.com/Raku/old-issue-tracker/issues/4441
throws-like 'class X is nosuchtrait { }', X::Inheritance::UnknownParent,
'Get unkown parent error even when class is called X';

Expand Down
4 changes: 3 additions & 1 deletion integration/advent2009-day11.t
Expand Up @@ -32,6 +32,8 @@ my $bob = DogWalker.new(name => 'Bob', dog => $fido);
is $bob.name, 'Bob', 'dog walker has a name';
is $bob.dog_name, 'Fido', 'dog name can be accessed by delegation';

# RT #75180
# https://github.com/Raku/old-issue-tracker/issues/1768
is Dog.^methods(:local)[0,1].map({.name}).sort.join('|'),
'bark|name', 'can introspect Dog';

# vim: ft=perl6
4 changes: 3 additions & 1 deletion integration/advent2013-day12.t
Expand Up @@ -75,7 +75,7 @@ is-deeply %h<a b c>:delete:k, ('a', 'b'), ':delete:k adverbs';
# Arrays are not Hashes
# ---------------------

#RT #121622
# https://github.com/Raku/old-issue-tracker/issues/3367
{
my @a;
@a[3] = 1;
Expand All @@ -96,3 +96,5 @@ is-deeply %h<a b c>:delete:k, ('a', 'b'), ':delete:k adverbs';
is-deeply @a[2,3,4], (2, 42, 4), '@a[2,3,4] (default)';
is-deeply @a[2,3,4]:exists, (True, False, True), '@a[2,3,4] (default)';
}

# vim: ft=perl6
2 changes: 2 additions & 0 deletions integration/deep-recursion-initing-native-array.t
Expand Up @@ -22,3 +22,5 @@ sub init-array($r, $c, $val) {
init-array($r + 1, $c, $val - 1);
}
}

# vim: ft=perl6
4 changes: 3 additions & 1 deletion integration/eval-and-threads.t
Expand Up @@ -3,7 +3,7 @@ use Test;

plan 1;

# RT #130951
# https://github.com/Raku/old-issue-tracker/issues/6131
lives-ok {
await Promise.allof((^3).map: {
start {
Expand All @@ -13,3 +13,5 @@ lives-ok {
}
});
}, 'Simple EVAL in a loop does not crash';

# vim: ft=perl6
10 changes: 6 additions & 4 deletions integration/precompiled.t
Expand Up @@ -24,20 +24,22 @@ loads_ok '42', "loads_ok is working";
precomp_loads_ok '42', "precomp_loads_ok is working";

# This was mysteriously broken with the previous CompUnit implementation.
# May have had something to do with dynamics. Maybe RT #82790 is relevant.
# May have had something to do with dynamics. Maybe
# https://github.com/Raku/old-issue-tracker/issues/2336 is relevant.
loads_is '42', 42, "loads_is is working";
precomp_loads_is '42', 42, "precomp_loads_is is working";

# RT #124162
# https://github.com/Raku/old-issue-tracker/issues/3755
precomp_loads_is '[ $(array[uint8].new(1)), $(array[uint8].new(1)) ]', [1,1],
"precompiled Array of native arrays (RT #124162)";

# RT #123679
# https://github.com/Raku/old-issue-tracker/issues/3657
precomp_loads_ok(['role Bar { has Str $.my-str handles <lines words> }','class Foo does Bar { }; my $io = Foo.new(:my-str<OHAI>);'], "precompiled role with handles trait on attribute");

precomp_loads_is 'BEGIN { EVAL "43" }', 43, "precompiled EVAL in BEGIN";

# RT #129856
# https://github.com/Raku/old-issue-tracker/issues/5744
loads_ok ['package Pod { class Ber {} }', 'Pod::Ber.new;'], 'a class in Pod namespace';
precomp_loads_ok ['package IO { class Ber {} }', 'IO::Ber.new;'], 'a class in IO namespace (precompiled)';

# vim: ft=perl6

0 comments on commit 2552970

Please sign in to comment.