summaryrefslogtreecommitdiffhomepage
path: root/test/t/array.rb
diff options
context:
space:
mode:
authorPaolo Bosetti <[email protected]>2012-05-29 14:32:05 -0700
committerPaolo Bosetti <[email protected]>2012-05-29 14:32:05 -0700
commitd73517877847dab5b345c7fa98091647737bbfe0 (patch)
tree6090a2df49b8093606181e5416e6aa6a5040b0ec /test/t/array.rb
parent391f8dcef02cdafeb4e0acc693945acb166a8d09 (diff)
parent1e5d15dbcb977f6d197c24eca4a973ee1c5bf521 (diff)
downloadmruby-d73517877847dab5b345c7fa98091647737bbfe0.tar.gz
mruby-d73517877847dab5b345c7fa98091647737bbfe0.zip
Merge branch 'master' of git://github.com/mruby/mruby into XCode
Diffstat (limited to 'test/t/array.rb')
-rw-r--r--test/t/array.rb42
1 files changed, 38 insertions, 4 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index 3b9dfedfb..dba1b035d 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -22,11 +22,47 @@ assert('Array#<<', '15.2.12.5.3') do
end
assert('Array#[]', '15.2.12.5.4') do
- [1,2,3].[](1) == 2
+ e2 = nil
+ e3 = nil
+ a = Array.new
+ begin
+ # this will cause an exception due to the wrong arguments
+ a.[]()
+ rescue => e1
+ e2 = e1
+ end
+ begin
+ # this will cause an exception due to the wrong arguments
+ a.[](1,2,3)
+ rescue => e1
+ e3 = e1
+ end
+
+ [1,2,3].[](1) == 2 and
+ e2.class == ArgumentError and
+ e3.class == ArgumentError
end
assert('Array#[]=', '15.2.12.5.5') do
- [1,2,3].[]=(1,4) == [1, 4, 3]
+ e2 = nil
+ e3 = nil
+ a = Array.new
+ begin
+ # this will cause an exception due to the wrong arguments
+ a.[]=()
+ rescue => e1
+ e2 = e1
+ end
+ begin
+ # this will cause an exception due to the wrong arguments
+ a.[]=(1,2,3,4)
+ rescue => e1
+ e3 = e1
+ end
+
+ [1,2,3].[]=(1,4) == [1, 4, 3] and
+ e2.class == ArgumentError and
+ e3.class == ArgumentError
end
assert('Array#clear', '15.2.12.5.6') do
@@ -193,5 +229,3 @@ assert('Array#unshift', '15.2.12.5.30') do
end
# Not ISO specified
-
-