diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb index 0b8c795cde..f978e24f6a 100644 --- a/bootstraptest/test_knownbug.rb +++ b/bootstraptest/test_knownbug.rb @@ -12,3 +12,38 @@ assert_finish 1, %q{ sleep 0.1 w.write "a" }, '[ruby-dev:31866]' + +assert_equal "[[nil, 1, 1, nil, nil], [nil, 2, 2, nil]]", %q{ + def tvar(var, val) + old = Thread.current[var] + begin + Thread.current[var] = val + yield + ensure + Thread.current[var] = old + end + end + ary1 = [] + ary2 = [] + fb = Fiber.new { + ary2 << Thread.current[:v] + tvar(:v, 2) { + ary2 << Thread.current[:v] + Fiber.yield + ary2 << Thread.current[:v] + } + ary2 << Thread.current[:v] + Fiber.yield + ary2 << Thread.current[:v] + } + ary1 << Thread.current[:v] + tvar(:v,1) { + ary1 << Thread.current[:v] + fb.resume + ary1 << Thread.current[:v] + } + ary1 << Thread.current[:v] + fb.resume + ary1 << Thread.current[:v] + [ary1, ary2] +}