diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Mar 5 04:42:52 2009 Yusuke Endoh <mame@tsg.ne.jp> + + * test/ruby/test_array.rb: fix wrong test, and add a test for + sort_by!. + Thu Mar 5 04:32:38 2009 Yusuke Endoh <mame@tsg.ne.jp> * test/ruby/test_array.rb: add some tests for coverage. diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 9c6834dc9d..d21cad0851 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1262,7 +1262,7 @@ class TestArray < Test::Unit::TestCase 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(nil, c.uniq! {|s| s[/^\w+/]}) assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c) assert_nil(@cls[1, 2, 3].uniq!) @@ -1694,4 +1694,10 @@ class TestArray < Test::Unit::TestCase assert_equal([1,2,3,4], a[0,4]) assert_equal([2,3,4,5], a[1,4]) end + + def test_sort_by! + a = [1,3,5,2,4] + a.sort_by! {|x| -x } + assert_equal([5,4,3,2,1], a) + end end |