mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 05:55:46 +02:00
Add comments about testing steps
This commit is contained in:
parent
4f324514aa
commit
c59da370a5
1 changed files with 6 additions and 4 deletions
|
@ -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")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue