diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-28 00:23:40 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-28 00:23:40 +0000 |
commit | 5bd2460a4e0f7820c2d722d90d80a79d33804ae2 (patch) | |
tree | 96849d6845b3c886de34a24fd7aa682021ee875d | |
parent | d1e04a013decd7565d816617022b152e03990fb5 (diff) | |
download | ruby-5bd2460a4e0f7820c2d722d90d80a79d33804ae2.tar.gz ruby-5bd2460a4e0f7820c2d722d90d80a79d33804ae2.tar.xz ruby-5bd2460a4e0f7820c2d722d90d80a79d33804ae2.zip |
thread variable test refined.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | bootstraptest/test_knownbug.rb | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb index f978e24f6..20533fa1b 100644 --- a/bootstraptest/test_knownbug.rb +++ b/bootstraptest/test_knownbug.rb @@ -13,7 +13,7 @@ assert_finish 1, %q{ w.write "a" }, '[ruby-dev:31866]' -assert_equal "[[nil, 1, 1, nil, nil], [nil, 2, 2, nil]]", %q{ +assert_equal "[[nil, 1, 3, 3, 1, nil, nil], [nil, 2, 2, nil]]", %q{ def tvar(var, val) old = Thread.current[var] begin @@ -26,24 +26,18 @@ assert_equal "[[nil, 1, 1, nil, nil], [nil, 2, 2, nil]]", %q{ 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] - 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 << Thread.current[:v]; tvar(:v,1) { + ary1 << Thread.current[:v]; tvar(:v,3) { + ary1 << Thread.current[:v]; fb.resume + ary1 << Thread.current[:v]; } + ary1 << Thread.current[:v]; } + ary1 << Thread.current[:v]; fb.resume + ary1 << Thread.current[:v]; [ary1, ary2] } |