Skip to content

Commit

Permalink
rakudo-fudge substr-rw.t
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed May 15, 2012
1 parent 7fa5f12 commit fb9e1c1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions S32-str/substr-rw.t
Expand Up @@ -16,11 +16,13 @@ sub l (Int $a) { my $l = $a; return $l }

#?pugs todo 'scalarrefs are not handled correctly'
$r = "boing";
#?rakudo todo 'NYI'
is($str, "boing ding", "assignment to reference modifies original");
is($r, "boing", '$r is consistent');

#?pugs todo 'scalarrefs are not handled correctly'
my $o = substr-rw($str, 3, 2);
#?rakudo 3 todo 'NYI'
is($o, "ng", "other ref to other lvalue");
$r = "foo";
#?pugs todo
Expand All @@ -31,17 +33,14 @@ sub l (Int $a) { my $l = $a; return $l }

}

#?rakudo skip 'substr-rw as lvalue NYI'
{ # as lvalue, should work
my $str = "gorch ding";

substr-rw($str, 0, 5) = "gloop";
is($str, "gloop ding", "lvalue assignment modified original string");
};

#?rakudo skip "substr-rw as lvalue NYI"
{ # as lvalue, using :=, should work
#?rakudo 3 todo 'exception'
my $str = "gorch ding";

substr-rw($str, 0, 5) = "gloop";
Expand All @@ -53,23 +52,22 @@ sub l (Int $a) { my $l = $a; return $l }
$r = "boing";
is($str, "boing ding", "assignment to bound var modifies original");
#?pugs todo 'bug'
#?rakudo todo 'NYI'
is($r, "boing", 'bound $r is consistent');

my $o := substr-rw($str, 3, 2);
#?rakudo 3 todo ' substr-rw lvalue binding'
is($o, "ng", "other bound var to other lvalue");
$r = "foo";
is($str, "foo ding", "lvalue ref size varies but still works");
#?pugs todo 'bug'
#?rakudo todo 'NYI'
is($o, " d", "other lvalue wiggled around");
};

#?rakudo skip "substr-rw as lvalue NYI"
{
my $str = "gorch ding";

substr-rw($str, 0, l(5)) = "gloop";
#?rakudo todo "substr-rw as lvalue"
is($str, "gloop ding", "lvalue assignment modified original string (substr-rw(Int, StrLen)).");

{
Expand All @@ -79,11 +77,13 @@ sub l (Int $a) { my $l = $a; return $l }

#?pugs todo 'scalarrefs are not handled correctly'
$$r = "boing";
#?rakudo todo 'NYI'
is($str, "boing ding", "assignment to reference modifies original (substr-rw(Int, StrLen)).");
is($$r, "boing", '$r is consistent (substr-rw(Int, StrLen)).');

#?pugs todo 'scalarrefs are not handled correctly'
my $o = \substr-rw($str, 3, l(2));
#?rakudo 3 todo 'NYI'
is($$o, "ng", "other ref to other lvalue (substr-rw(Int, StrLen)).");
$$r = "foo";
#?pugs todo
Expand All @@ -94,17 +94,14 @@ sub l (Int $a) { my $l = $a; return $l }

}

#?rakudo skip 'substr-rw as lvalue NYI'
{ # as lvalue, should work
my $str = "gorch ding";

substr-rw($str, 0, l(5)) = "gloop";
is($str, "gloop ding", "lvalue assignment modified original string (substr-rw(Int, StrLen)).");
};

#?rakudo skip 'substr-rw as lvalue NYI'
{ # as lvalue, using :=, should work
#?rakudo 3 todo 'substr-rw as lvalue NYI'
my $str = "gorch ding";

substr-rw($str, 0, l(5)) = "gloop";
Expand All @@ -116,14 +113,15 @@ sub l (Int $a) { my $l = $a; return $l }
$r = "boing";
is($str, "boing ding", "assignment to bound var modifies original (substr-rw(Int, StrLen)).");
#?pugs todo 'bug'
#?rakudo todo 'NYI'
is($r, "boing", 'bound $r is consistent (substr-rw(Int, StrLen)).');

my $o := substr-rw($str, 3, l(2));
#?rakudo 3 todo ' substr-rw lvalue binding'
is($o, "ng", "other bound var to other lvalue (substr-rw(Int, StrLen)).");
$r = "foo";
is($str, "foo ding", "lvalue ref size varies but still works (substr-rw(Int, StrLen)).");
#?pugs todo 'bug'
#?rakudo todo 'NYI'
is($o, " d", "other lvalue wiggled around (substr-rw(Int, StrLen)).");
};

Expand Down

0 comments on commit fb9e1c1

Please sign in to comment.