summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-02 10:03:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-02 10:03:54 +0000
commitb6fe3dae4de7002c2f58bc9cfb993033dff7927d (patch)
treeb017b82c48b45ae98f3ed92acb3863372ed9d77f /sample
parenta1d8147e4419d81cd93c664b85f7062c89101c87 (diff)
call initialize
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb9
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 = []