From 58282ed667d720816366c9e45c3560904196d078 Mon Sep 17 00:00:00 2001 From: kosaki Date: Mon, 19 Nov 2012 09:43:53 +0000 Subject: * 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 --- test/ruby/test_signal.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3