Merge pull request #393 from akuroda/array_last_fix

fix segmentation fault in Array#last
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-07-24 16:55:12 -07:00
2 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -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