summaryrefslogtreecommitdiff
path: root/spec/ruby/core/signal/trap_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/signal/trap_spec.rb')
-rw-r--r--spec/ruby/core/signal/trap_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/signal/trap_spec.rb b/spec/ruby/core/signal/trap_spec.rb
index 831a5ee23e..45879b7147 100644
--- a/spec/ruby/core/signal/trap_spec.rb
+++ b/spec/ruby/core/signal/trap_spec.rb
@@ -49,7 +49,21 @@ platform_is_not :windows do
it "registers an handler doing nothing with :IGNORE" do
Signal.trap :HUP, :IGNORE
+ Signal.trap(:HUP, @saved_trap).should == "IGNORE"
+ end
+
+ it "can register a new handler after :IGNORE" do
+ Signal.trap :HUP, :IGNORE
+
+ done = false
+ Signal.trap(:HUP) do
+ ScratchPad.record :block_trap
+ done = true
+ end
+
Process.kill(:HUP, Process.pid).should == 1
+ Thread.pass until done
+ ScratchPad.recorded.should == :block_trap
end
it "ignores the signal when passed nil" do