summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-19 09:43:53 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-19 09:43:53 +0000
commit58282ed667d720816366c9e45c3560904196d078 (patch)
tree6f3f88443f75e507f31de9ece79228daf670229d /test
parent92cef134b54fadb79e5d338a3aea1b51ff500386 (diff)
* signal.c (sig_signame): implements Signal.signame method
[Feature #5613] * test/ruby/test_signal.rb (test_signame): adds test for above * NEWS: add an item about above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_signal.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index 0e3af06d7b..eaf21b8f2d 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -240,4 +240,22 @@ EOS
}
end
+ def test_signame
+ return unless Process.respond_to?(:kill)
+
+ begin
+ 10.times do
+ caught = 0
+ signame = "wrong"
+
+ Signal.trap("INT") { |signo| signame = Signal.signame(signo); caught = 1; }
+ Process.kill("INT", 0)
+
+ sleep 0.01 while caught==0
+ assert_equal(signame, "INT")
+ end
+ ensure
+ Signal.trap("INT", "DEFAULT")
+ end
+ end
end