diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_iterator.rb | 12 |
2 files changed, 17 insertions, 0 deletions
@@ -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 diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index 0db54302f5..cc0fe76d7b 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -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 |