Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update tests for .values; .values returns something safely mutable.

  • Loading branch information...
commit e47e2da72539addd4dea4c642229697613b43d41 1 parent 15c92c1
@pmichaud pmichaud authored
Showing with 9 additions and 3 deletions.
  1. +3 −2 S09-typed-arrays/arrays.t
  2. +6 −1 S32-array/keys_values.t
View
5 S09-typed-arrays/arrays.t
@@ -93,12 +93,13 @@ lives_ok { my @x = 1 .. 3 }, 'initialization of typed array from range';
my Int @a = 1, 2, 3;
my Int @b;
lives_ok { @b = @a }, 'can assign typed array to typed array';
- ok @a.values.of === Int, '@a.values is typed (1)';
+ #?rakudo skip 'need parameterized Lists'
+ ok @a.values.of.WHICH eqv Int.WHICH, '@a.values is typed (1)';
lives_ok { @b = @a.values }, '@a.values is typed (2)';
#?rakudo 2 skip 'initialization'
my Str @c = <foo bar baz>;
- ok @c.keys.of === Str, '@array.keys is typed with Int';
+ ok @c.keys.of.WHICH eqv Str.WHICH, '@array.keys is typed with Int';
}
# test that we can have parametric array return types
View
7 S32-array/keys_values.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 6;
+plan 8;
=begin description
@@ -22,4 +22,9 @@ is(~@array.values, 'a b c d', '@array.values works');
is(~values(@array), 'a b c d', 'values(@array) works');
is(+@array.values, +@array, 'we have the same number of values as elements in the array');
+my $v := @array.values;
+$v.shift; $v.shift;
+is($v.elems, 2, "shifting .values removes an element...");
+is(@array.elems, 4, "...while leaving original list alone.");
+
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.