summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2012-07-25 16:13:44 +0900
committerMasaki Muranaka <[email protected]>2012-07-25 16:13:44 +0900
commit1cda5e0768e6d57db30a82f343d6aff2c6bc6b24 (patch)
tree5338c7113dfa52aec307bdcc8b1a15e7f8cfcef0 /test
parent328353b287bcacf29108766f8f89891bb1cf3281 (diff)
downloadmruby-1cda5e0768e6d57db30a82f343d6aff2c6bc6b24.tar.gz
mruby-1cda5e0768e6d57db30a82f343d6aff2c6bc6b24.zip
Add tests for coverage.
Diffstat (limited to 'test')
-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 a1ef830a2..a113df1f4 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
@@ -242,6 +243,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