From a28d3d591dc6a37cb2544d529a888a99c63e4328 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 10 Oct 2016 06:14:07 +0000 Subject: [PATCH] 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 --- test/ruby/test_require.rb | 43 +++++++++++++++++++++------------------ 1 file 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)