2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Signal.signame" do
|
|
|
|
it "takes a signal name with a well known signal number" do
|
|
|
|
Signal.signame(0).should == "EXIT"
|
|
|
|
end
|
|
|
|
|
2018-04-28 15:50:06 -04:00
|
|
|
it "returns nil if the argument is an invalid signal number" do
|
|
|
|
Signal.signame(-1).should == nil
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "raises a TypeError when the passed argument can't be coerced to Integer" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { Signal.signame("hello") }.should raise_error(TypeError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
2018-01-29 11:08:16 -05:00
|
|
|
|
|
|
|
platform_is_not :windows do
|
2019-02-07 11:35:33 -05:00
|
|
|
it "the original should take precedence over alias when looked up by number" do
|
2018-01-29 11:08:16 -05:00
|
|
|
Signal.signame(Signal.list["ABRT"]).should == "ABRT"
|
|
|
|
Signal.signame(Signal.list["CHLD"]).should == "CHLD"
|
|
|
|
end
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|