diff options
Diffstat (limited to 'sample')
-rw-r--r-- | sample/test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb index 69a168f2c4..98c913667a 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -277,11 +277,20 @@ ok($x[0] == -1 && $x[1] == 10) $x[-1, 1] = 20 ok($x[-1] == 20 && $x.pop == 20) +# array and/or +ok(([1,2,3]&[2,4,6]) == [2]) +ok(([1,2,3]|[2,4,6]) == [1,2,3,4,6]) + # compact $x = [nil, 1, nil, nil, 5, nil, nil] $x.compact! ok($x == [1, 5]) +# uniq +$x = [1, 1, 4, 2, 5, 4, 5, 1, 2] +$x.uniq! +ok($x == [1, 4, 2, 5]) + # empty? ok(!$x.empty?) $x = [] |