From 4f324514aa5b3dd598f31cf41602dd414e0fbaca Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 11 Aug 2021 14:07:28 +0900 Subject: Put the result of the process into a variable once To make the meaning of assertion easier to understand, --- test/readline/test_readline.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 280c6ddb44..0a8971320b 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -539,18 +539,20 @@ module BasetestReadline log << "** Errno::EPIPE **" # The "write" will fail if Reline crashed by SIGINT. end + interrupt_suppressed = nil loop do c = _out.read(1) log << c if c if log.include?('FAILED') - assert false, "Should handle SIGINT correctly but raised interrupt.\nLog: #{log}\n----" + interrupt_suppressed = false break end if log.include?('SUCCEEDED') - assert false, "Should handle SIGINT correctly but exited successfully.\nLog: #{log}\n----" + interrupt_suppressed = true break end end + assert interrupt_suppressed, "Should handle SIGINT correctly but raised interrupt.\nLog: #{log}\n----" rescue Timeout::Error => e assert false, "Timed out to handle SIGINT!\nLog: #{log}\nBacktrace:\n#{e.full_message(highlight: false)}\n----" end -- cgit v1.2.3