diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-12 13:01:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-12 13:01:40 +0000 |
commit | dfbca1ab5dd87ff2cf65d5eda5746e8416c6ee7e (patch) | |
tree | c1e35f2633af74ccf0e73915449ac5383e8e0ea0 /test | |
parent | 9651e9bc24b7bb67dfd1e5943aea251b6150cf9f (diff) | |
download | ruby-dfbca1ab5dd87ff2cf65d5eda5746e8416c6ee7e.tar.gz |
vm.c: break from orphan block
* vm.c (rb_vm_search_cf_from_ep): break from orphan block is
possible condition, but not [BUG].
[ruby-core:69548] [Bug #11254]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_enum.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index f774c4260b..09f978502a 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -53,7 +53,8 @@ class TestEnumerable < Test::Unit::TestCase bug5801 = '[ruby-dev:45041]' @empty.grep(//) - assert_nothing_raised(bug5801) {100.times {@empty.block.call}} + block = @empty.block + assert_nothing_raised(bug5801) {100.times {block.call}} a = [] lambda = ->(x, i) {a << [x, i]} @@ -201,6 +202,21 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(1, @obj.first) assert_equal([1, 2, 3], @obj.first(3)) assert_nil(@empty.first) + + bug5801 = '[ruby-dev:45041]' + assert_in_out_err([], <<-'end;', [], /unexpected break/) + empty = Object.new + class << empty + attr_reader :block + include Enumerable + def each(&block) + @block = block + self + end + end + empty.first + empty.block.call + end; end def test_sort @@ -440,7 +456,8 @@ class TestEnumerable < Test::Unit::TestCase bug5801 = '[ruby-dev:45040]' @empty.take_while {true} - assert_nothing_raised(bug5801) {100.times {@empty.block.call}} + block = @empty.block + assert_nothing_raised(bug5801) {100.times {block.call}} end def test_drop |