1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_array.rb: add some tests for coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2009-03-04 19:33:14 +00:00
parent 00305d36f0
commit 6273951869
2 changed files with 18 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Thu Mar 5 04:32:38 2009 Yusuke Endoh <mame@tsg.ne.jp>
* test/ruby/test_array.rb: add some tests for coverage.
Thu Mar 5 00:06:37 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/README.win32 (Requirement): added unicows.lib and dll.

View file

@ -777,6 +777,8 @@ class TestArray < Test::Unit::TestCase
assert_equal(4, a.index([1,2,3]))
assert_nil(a.index('ca'))
assert_nil(a.index([1,2]))
assert_equal(1, a.index(99) {|x| x == 'cat' })
end
def test_values_at
@ -1032,6 +1034,8 @@ class TestArray < Test::Unit::TestCase
assert_equal(4, a.rindex([1,2,3]))
assert_nil(a.rindex('ca'))
assert_nil(a.rindex([1,2]))
assert_equal(3, a.rindex(99) {|x| x == [1,2,3] })
end
def test_shift
@ -1257,6 +1261,10 @@ class TestArray < Test::Unit::TestCase
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c.uniq! {|s| s[/^\w+/]})
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c)
c = @cls["a:def", "b:abc", "c:jkl"]
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c.uniq! {|s| s[/^\w+/]})
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c)
assert_nil(@cls[1, 2, 3].uniq!)
end
@ -1680,4 +1688,10 @@ class TestArray < Test::Unit::TestCase
a.fill(:foo, 5, -3)
assert_equal((1..10).to_a, a)
end
def test_slice_freezed_array
a = [1,2,3,4,5].freeze
assert_equal([1,2,3,4], a[0,4])
assert_equal([2,3,4,5], a[1,4])
end
end