Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fudge/Unfudge for latest [].exists|delete fixes
  • Loading branch information
lizmat committed Sep 18, 2013
1 parent f728c56 commit bc14b79
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion S02-names-vars/varnames.t
Expand Up @@ -20,7 +20,7 @@ eval_dies_ok 'my $fo:o::b:ar = "bla"', "var names can't have colons in their nam
#?pugs skip "Can't modify constant item: VObject"
{
class MyMatch {
method postcircumfix:<[ ]>($x) {
method at_pos($x) {
"foo$x";
}
}
Expand Down
2 changes: 0 additions & 2 deletions S03-binding/arrays.t
Expand Up @@ -39,15 +39,13 @@ plan 47;
@array.delete(1);
# $var unchanged, but assigning to $var doesn't modify @array any
# longer; similarily, changing @array[1] doesn't modify $var now
#?rakudo todo 'array binding, delete'
#?niecza todo 'array binding, delete'
is $var, "e", "binding of array elements works with .delete (2)";
is ~@array, "a c", "binding of array elements works with .delete (3)";

$var = "f";
@array[1] = "g";
#?niecza todo 'array binding, delete'
#?rakudo todo 'array binding, delete'
is $var, "f", "binding of array elements works with .delete (4)";
is @array[1], "g", "binding of array elements works with .delete (5)";
}
Expand Down
2 changes: 1 addition & 1 deletion S13-overloading/operators.t
Expand Up @@ -23,7 +23,7 @@ plan 4;
#?pugs todo
{
class A does Associative {
method postcircumfix:<{ }>(*@ix) {
method at_key(*@ix) {
return @ix
}
};
Expand Down
22 changes: 13 additions & 9 deletions S32-array/delete.t
Expand Up @@ -23,27 +23,28 @@ sub make-string(@a) {
"deletion of an array element returned the right thing";
is make-string(@array), "a b Any() d", "deletion of an array element";

is ~@array.delete(0, 3), "a d",
is ~@array.delete(3), "d",
"deletion of array elements returned the right things";
#?pugs todo
is make-string(@array), "Any() b", "deletion of array elements (1)";
is make-string(@array), "a b", "deletion of array elements (1)";
#?pugs todo
is +@array, 2, "deletion of array elements (2)";
}

# W/ negative indices:
#?rakudo skip ":delete NYI, but will be shortly"
{
my @array = <a b c d>;
#?pugs todo
is ~@array.delete(*-2), "c",
is ~@array[*-2]:delete, "c",
"deletion of array element accessed by an negative index returned the right thing";
# @array is now ("a", "b", Any, "d") ==> double spaces
#?pugs todo
is make-string(@array), "a b Any() d", "deletion of an array element accessed by an negative index (1)";
is +@array, 4, "deletion of an array element accessed by an negative index (2)";

#?pugs todo
is ~@array.delete(*-1), "d",
is ~@array[*-1]:delete, "d",
"deletion of last array element returned the right thing";
# @array is now ("a", "b")
#?pugs todo
Expand All @@ -54,9 +55,10 @@ sub make-string(@a) {

# W/ multiple positive and negative indices:
#?pugs todo
#?rakudo skip ":delete NYI, but will be shortly"
{
my @array = <a b c d e f>;
is ~@array.delete(2, *-3, *-1), "c d f",
is ~@array[2, *-3, *-1]:delete, "c d f",
"deletion of array elements accessed by positive and negative indices returned right things";
# @array is now ("a", "b", Any, Any, "e") ==> double spaces
is make-string(@array), "a b Any() Any() e",
Expand All @@ -67,11 +69,11 @@ sub make-string(@a) {

# Results taken from Perl 5
#?niecza todo "Not sure if this test is correct or not"
#?rakudo todo "Not sure if this test is correct or not"
#?pugs todo "Not sure if this test is correct or not"
#?rakudo skip ":delete NYI, but will be shortly"
{
my @array = <a b c>;
is ~@array.delete(2, *-1), "c b",
is ~@array[2, *-1]:delete, "c b",
"deletion of the same array element accessed by different indices returned right things";
is ~@array, "a",
"deletion of the same array element accessed by different indices (1)";
Expand All @@ -90,9 +92,10 @@ sub make-string(@a) {
}

# W/ one range of positive indices
#?rakudo skip ":delete NYI, but will be shortly"
{
my @array = <a b c d e f>;
is ~@array.delete(2..4), "c d e",
is ~@array[2..4]:delete, "c d e",
"deletion of array elements accessed by a range of positives indices returned right things";
# @array is now ("a", "b", Any, Any, Any, "f") ==> 4 spaces
is make-string(@array), "a b Any() Any() Any() f",
Expand All @@ -101,9 +104,10 @@ sub make-string(@a) {
"deletion of array elements accessed by a range of positive indices (2)";
}

#?rakudo skip ":delete NYI, but will be shortly"
{
my @array = <a b c d e f>;
is ~@array.delete(2^..4), "d e",
is ~@array[2^..4]:delete, "d e",
"deletion of array elements accessed by a range of positives indices returned right things (2)";
# @array is now ("a", "b", "c", Any, Any, "f") ==> 4 spaces
is make-string(@array), "a b c Any() Any() f",
Expand Down

0 comments on commit bc14b79

Please sign in to comment.