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

* enum.c (enum_slice_before): take a pattern if no block given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-10-02 11:50:11 +00:00
parent aec8a4b0a4
commit 2e70b9e70d
3 changed files with 48 additions and 18 deletions

View file

@ -383,6 +383,10 @@ class TestEnumerable < Test::Unit::TestCase
assert_not_same(hs[0], hs[1])
assert_not_same(hs[0], hs[2])
assert_not_same(hs[1], hs[2])
ss = %w[abc defg h ijk l mno pqr st u vw xy z]
assert_equal([%w[abc defg h], %w[ijk l], %w[mno], %w[pqr st u vw xy z]],
ss.slice_before(/\A...\z/).to_a)
end
end