summaryrefslogtreecommitdiffhomepage
path: root/test/t/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-07-26 04:33:44 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-07-26 04:33:44 -0700
commita621f08ecfd1fae5b4878d33d3688bc421e968e9 (patch)
tree3fa55d126c3ec13f89dcad61f89e07b8cf50d883 /test/t/array.rb
parentaed200686f626951d919d17e37b6dc135b015c2d (diff)
parent1cda5e0768e6d57db30a82f343d6aff2c6bc6b24 (diff)
downloadmruby-a621f08ecfd1fae5b4878d33d3688bc421e968e9.tar.gz
mruby-a621f08ecfd1fae5b4878d33d3688bc421e968e9.zip
Merge pull request #395 from monaka/pr-add-more-test-for-array
Add tests for coverage.
Diffstat (limited to 'test/t/array.rb')
-rw-r--r--test/t/array.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index 4ed12a58f..7029cd3c6 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -65,6 +65,7 @@ assert('Array#[]=', '15.2.12.5.5') do
end
[1,2,3].[]=(1,4) == [1, 4, 3] and
+ [1,2,3].[]=(1,2,3) == [1, 3] and
e2.class == ArgumentError and
e3.class == ArgumentError
end
@@ -250,6 +251,21 @@ assert('Array#to_s', '15.2.12.5.31') do
r1 == r2 and r1 == "[2, 3, 4, 5]"
end
+assert('Array#==', '15.2.12.5.33') do
+ r1 = [ "a", "c" ] == [ "a", "c", 7 ] #=> false
+ r2 = [ "a", "c", 7 ] == [ "a", "c", 7 ] #=> true
+ r3 = [ "a", "c", 7 ] == [ "a", "d", "f" ] #=> false
+
+ r1 == false and r2 == true and r3 == false
+end
+
+assert('Array#<=>', '15.2.12.5.36') do
+ r1 = [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
+ r2 = [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
+
+ r1 == -1 and r2 == +1
+end
+
# Not ISO specified
assert("Array (Shared Array Corruption)") do