diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-31 05:59:23 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-31 05:59:23 +0000 |
| commit | 079de9aec4545fd298cd96ea5d63db10229d5a0f (patch) | |
| tree | a68a5a47d308a21eccffe47491709769c2eb627a /test | |
| parent | da22e5954e58e55ed1f61f84dd9c7028662375f3 (diff) | |
| download | ruby-079de9aec4545fd298cd96ea5d63db10229d5a0f.tar.gz ruby-079de9aec4545fd298cd96ea5d63db10229d5a0f.tar.xz ruby-079de9aec4545fd298cd96ea5d63db10229d5a0f.zip | |
* eval.c (rb_iterate): need to PUSH_ITER in proper order.
[ruby-core:10125]
* test/ruby/test_iterator.rb (TestIterator::test_block_given_within_iterator):
add new test. [ruby-core:10125]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@11606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_iterator.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index 638916309..2cd48b29a 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -462,4 +462,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 |
