зеркало из https://github.com/github/ruby.git
* test/ruby/test_iterator.rb (TestIterator::test_block_given_within_iterator):
add new test. [ruby-core:10125] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
900546717e
Коммит
ff95fbdea8
|
@ -1,3 +1,8 @@
|
|||
Wed Jan 31 14:52:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_iterator.rb (TestIterator::test_block_given_within_iterator):
|
||||
add new test. [ruby-core:10125]
|
||||
|
||||
Wed Jan 31 14:45:54 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/open-uri.rb (OpenURI::OpenURI.open_uri): use user and
|
||||
|
|
|
@ -467,4 +467,16 @@ class TestIterator < Test::Unit::TestCase
|
|||
assert_equal(ok, result)
|
||||
return
|
||||
end
|
||||
|
||||
class IterString < ::String
|
||||
def ===(other)
|
||||
super if !block_given?
|
||||
end
|
||||
end
|
||||
|
||||
# Check that the block passed to an iterator
|
||||
# does not get propagated inappropriately
|
||||
def test_block_given_within_iterator
|
||||
assert_equal(["b"], ["a", "b", "c"].grep(IterString.new("b")) {|s| s})
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче