diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-10 06:14:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-10 06:14:07 +0000 |
commit | a28d3d591dc6a37cb2544d529a888a99c63e4328 (patch) | |
tree | 01e634ff50b41d1a08781f3b590bb94ee6f15680 /test/ruby/test_require.rb | |
parent | 3ef1149bbe7afc411214a41d125497ac8fd2d859 (diff) | |
download | ruby-a28d3d591dc6a37cb2544d529a888a99c63e4328.tar.gz |
test_require.rb: use assert_separately
* test/ruby/test_require.rb (test_loading_fifo_threading_raise):
use assert_separately.
* test/ruby/test_require.rb (test_loading_fifo_threading_success):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_require.rb')
-rw-r--r-- | test/ruby/test_require.rb | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index c80a818710..b5802e71c4 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -720,14 +720,14 @@ class TestRequire < Test::Unit::TestCase f.close File.unlink(f.path) File.mkfifo(f.path) - assert_ruby_status(["-", f.path], <<-END, timeout: 3) - th = Thread.current - Thread.start {begin sleep(0.001) end until th.stop?; th.raise(IOError)} - begin - load(ARGV[0]) - rescue IOError - end - END + assert_separately(["-", f.path], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 3) + begin; + th = Thread.current + Thread.start {begin sleep(0.001) end until th.stop?; th.raise(IOError)} + assert_raise(IOError) do + load(ARGV[0]) + end + end; } end if File.respond_to?(:mkfifo) @@ -737,20 +737,23 @@ class TestRequire < Test::Unit::TestCase File.unlink(f.path) File.mkfifo(f.path) - assert_ruby_status(["-", f.path], <<-INPUT, timeout: 3) - path = ARGV[0] - th = Thread.current - Thread.start { - begin - sleep(0.001) - end until th.stop? - open(path, File::WRONLY | File::NONBLOCK) {|fifo_w| - fifo_w.print "__END__\n" # ensure finishing + assert_separately(["-", f.path], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 3) + begin; + path = ARGV[0] + th = Thread.current + $ok = false + Thread.start { + begin + sleep(0.001) + end until th.stop? + open(path, File::WRONLY | File::NONBLOCK) {|fifo_w| + fifo_w.print "$ok = true\n__END__\n" # ensure finishing + } } - } - load(path) - INPUT + load(path) + assert($ok) + end; } end if File.respond_to?(:mkfifo) |