summaryrefslogtreecommitdiffhomepage
path: root/test/t/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-07-24 16:55:12 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-07-24 16:55:12 -0700
commitec309c6fd7a8e177be4d1c5cd3cebfcf2088a52d (patch)
treed855fd0600b0ce01abcecf0be639013f0518a256 /test/t/array.rb
parent08213e32e817f83313b1586d76c0e8735ba210e7 (diff)
parentf114e3e25236cd43d2f71419e4929caaa755020e (diff)
downloadmruby-ec309c6fd7a8e177be4d1c5cd3cebfcf2088a52d.tar.gz
mruby-ec309c6fd7a8e177be4d1c5cd3cebfcf2088a52d.zip
Merge pull request #393 from akuroda/array_last_fix
fix segmentation fault in Array#last
Diffstat (limited to 'test/t/array.rb')
-rw-r--r--test/t/array.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index a1ef830a2..4ed12a58f 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -152,7 +152,15 @@ end
assert('Array#last', '15.2.12.5.18') do
a = [1,2,3]
- a.last == 3 and [].last == nil
+ e2 = nil
+ begin
+ # this will cause an exception due to the wrong argument
+ [1,2,3].last(-1)
+ rescue => e1
+ e2 = e1
+ end
+
+ a.last == 3 and [].last == nil and e2.class == ArgumentError
end
assert('Array#length', '15.2.12.5.19') do