Add comments about testing steps

This commit is contained in:
aycabta 2021-08-11 14:08:39 +09:00
parent 4f324514aa
commit c59da370a5

View file

@ -496,18 +496,20 @@ module BasetestReadline
end end
} }
Readline.input = STDIN Readline.input = STDIN
# 0. Send SIGINT to this script.
begin begin
Thread.new{ Thread.new{
trap(:INT) { trap(:INT) {
puts 'TRAP' puts 'TRAP' # 2. Show 'TRAP' message.
} }
Readline.readline('input> ') Readline.readline('input> ') # 1. Should keep working and call old trap.
# 4. Receive "\\n" and return because still working.
}.value }.value
rescue Interrupt rescue Interrupt
puts 'FAILED' puts 'FAILED' # 3. "Interrupt" shouldn't be raised because trapped.
raise raise
end end
puts 'SUCCEEDED' puts 'SUCCEEDED' # 5. Finish correctly.
end; end;
script = Tempfile.new("interrupt_in_other_thread") script = Tempfile.new("interrupt_in_other_thread")