summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-15 07:34:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-15 07:34:03 +0000
commitd0885b5cd816b3b4aa5a613af3c028c1123999a6 (patch)
treebe8a5adb9514df9c91b4848e81c32be0415f3356
parent111327c535e82716306460499fa5d9d1bde1b6a9 (diff)
test_array.rb: add test
* test/ruby/test_array.rb (test_last2): add test for Array#last with length argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_array.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 873c497..f4faa9b 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1794,6 +1794,11 @@ class TestArray < Test::Unit::TestCase
assert_raise(ArgumentError) { [0].first(-1) }
end
+ def test_last2
+ assert_equal([0], [0].last(2))
+ assert_raise(ArgumentError) { [0].last(-1) }
+ end
+
def test_shift2
assert_equal(0, ([0] * 16).shift)
# check