diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-12 09:24:13 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-12 09:24:13 +0000 |
commit | b2e399636a51eeef995f737c32fef853869ed696 (patch) | |
tree | df631f8c7545279ace105248ea9cf5216f54d72f /yarvtest/test_thread.rb | |
parent | ab2119fc3d61a7504d836cfb0231b736c1c33742 (diff) | |
download | ruby-b2e399636a51eeef995f737c32fef853869ed696.tar.gz |
* yarvtest: removed because it's outdated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvtest/test_thread.rb')
-rw-r--r-- | yarvtest/test_thread.rb | 209 |
1 files changed, 0 insertions, 209 deletions
diff --git a/yarvtest/test_thread.rb b/yarvtest/test_thread.rb deleted file mode 100644 index 072e065497..0000000000 --- a/yarvtest/test_thread.rb +++ /dev/null @@ -1,209 +0,0 @@ - -require 'yarvtest/yarvtest' - -class TestThread < YarvTestBase - def test_create - ae %q{ - Thread.new{ - }.join - :ok - } - ae %q{ - Thread.new{ - :ok - }.value - } - end - - def test_create_many_threads1 - ae %q{ - v = 0 - (1..200).map{|i| - Thread.new{ - i - } - }.each{|t| - v += t.value - } - v - } - end - - def test_create_many_threads2 - ae %q{ - 5000.times{|e| - (1..2).map{ - Thread.new{ - } - }.each{|e| - e.join - } - } - } - end - - def test_create_many_threads3 - ae %q{ - 5000.times{ - t = Thread.new{} - while t.alive? - Thread.pass - end - } - } - end - - def test_create_many_threads4 - ae %q{ - 100.times{ - Thread.new{loop{Thread.pass}} - } - } - end - - def test_raise - ae %q{ - t = Thread.new{ - sleep - } - sleep 0.1 - t.raise - begin - t.join - :ng - rescue - :ok - end - } - ae %q{ - t = Thread.new{ - loop{} - } - Thread.pass - t.raise - begin - t.join - :ng - rescue - :ok - end - } - ae %q{ - t = Thread.new{ - } - Thread.pass - t.join - t.raise # raise to exited thread - begin - t.join - :ok - rescue - :ng - end - } - end - - def test_status - ae %q{ - t = Thread.new{ - loop{} - } - st = t.status - t.kill - st - } - ae %q{ - t = Thread.new{ - sleep - } - sleep 0.1 - st = t.status - t.kill - st - } - ae %q{ - t = Thread.new{ - } - t.kill - sleep 0.1 - t.status - } - end - - def test_tlv - ae %q{ - Thread.current[:a] = 1 - Thread.new{ - Thread.current[:a] = 10 - Thread.pass - Thread.current[:a] - }.value + Thread.current[:a] - } - end - - def test_thread_group - ae %q{ - ptg = Thread.current.group - Thread.new{ - ctg = Thread.current.group - [ctg.class, ctg == ptg] - }.value - } - ae %q{ - thg = ThreadGroup.new - - t = Thread.new{ - thg.add Thread.current - sleep - } - sleep 0.1 - [thg.list.size, ThreadGroup::Default.list.size] - } - end - - def test_thread_local_svar - ae %q{ - /a/ =~ 'a' - $a = $~ - Thread.new{ - $b = $~ - /a/ =~ 'a' - $c = $~ - } - $d = $~ - [$a == $d, $b, $c != $d] - } - end - - def test_join - ae %q{ - Thread.new{ - :ok - }.join.value - } - ae %q{ - begin - Thread.new{ - raise "ok" - }.join - rescue => e - e - end - } - ae %q{ - ans = nil - t = Thread.new{ - begin - sleep 0.5 - ensure - ans = :ok - end - } - Thread.pass - t.kill - t.join - ans - } - end -end - |