From f114e3e25236cd43d2f71419e4929caaa755020e Mon Sep 17 00:00:00 2001 From: Akira Kuroda Date: Wed, 25 Jul 2012 00:05:51 +0900 Subject: fix segmentation fault in Array#last --- test/t/array.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test') 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 -- cgit v1.2.3