summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-05 11:55:21 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-05 11:55:21 +0900
commitdc0c04764fbd65c28337c37f70cbf71c0cadffe1 (patch)
tree2c2d3bf7585c1cf444390b18d639a45a98f03e95 /test/ruby/test_process.rb
parent521e25baa42c31cc40e60c1da3a5e8e147255ef9 (diff)
Refined assertion messages
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index b96acb1373..1d20c11ecc 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -246,18 +246,16 @@ class TestProcess < Test::Unit::TestCase
assert_raise(ArgumentError) do
system(RUBY, '-e', 'exit', 'rlimit_bogus'.to_sym => 123)
end
- assert_separately([],"#{<<-"begin;"}\n#{<<~'end;'}")
+ assert_separately([],"#{<<~"begin;"}\n#{<<~'end;'}", 'rlimit_cpu'.to_sym => 3600)
BUG = "[ruby-core:82033] [Bug #13744]"
- RUBY = "#{RUBY}"
begin;
- assert(system("#{RUBY}", "-e",
- "exit([3600,3600] == Process.getrlimit(:CPU))",
- 'rlimit_cpu'.to_sym => 3600), BUG)
- assert_raise(ArgumentError, BUG) do
- system("#{RUBY}", '-e', 'exit', :rlimit_bogus => 123)
- end
+ assert_equal([3600,3600], Process.getrlimit(:CPU), BUG)
end;
+ assert_raise_with_message(ArgumentError, /bogus/) do
+ system(RUBY, '-e', 'exit', :rlimit_bogus => 123)
+ end
+
assert_raise_with_message(ArgumentError, /rlimit_cpu/) {
system(RUBY, '-e', 'exit', "rlimit_cpu\0".to_sym => 3600)
}
@@ -636,7 +634,7 @@ class TestProcess < Test::Unit::TestCase
rescue NotImplementedError
return
end
- assert(FileTest.pipe?("fifo"), "should be pipe")
+ assert_file.pipe?("fifo")
t1 = Thread.new {
system(*ECHO["output to fifo"], :out=>"fifo")
}
@@ -1635,7 +1633,7 @@ class TestProcess < Test::Unit::TestCase
w.puts
end
Process.wait pid
- assert sig_r.wait_readable(5), 'self-pipe not readable'
+ assert_send [sig_r, :wait_readable, 5], 'self-pipe not readable'
end
if RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE. It may trigger extra SIGCHLD.
assert_equal [true], signal_received.uniq, "[ruby-core:19744]"
@@ -2260,7 +2258,7 @@ EOS
th = Process.detach(pid)
assert_equal pid, th.pid
status = th.value
- assert status.success?, status.inspect
+ assert_predicate status, :success?
end if defined?(fork)
def test_kill_at_spawn_failure