summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/status
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-11-30 21:26:52 +0100
committerBenoit Daloze <eregontp@gmail.com>2019-11-30 21:26:52 +0100
commit1243255c3a36433041012b6107a5ac48658a0895 (patch)
tree04440f84b48999ff08d4a2a16d066d0ad731400e /spec/ruby/core/process/status
parentab8345271eb87ff155d8bd5f22f53a4cf2902c26 (diff)
Update to ruby/spec@4eec3dc
Diffstat (limited to 'spec/ruby/core/process/status')
-rw-r--r--spec/ruby/core/process/status/equal_value_spec.rb12
-rw-r--r--spec/ruby/core/process/status/exitstatus_spec.rb2
-rw-r--r--spec/ruby/core/process/status/termsig_spec.rb8
-rw-r--r--spec/ruby/core/process/status/to_i_spec.rb10
4 files changed, 21 insertions, 11 deletions
diff --git a/spec/ruby/core/process/status/equal_value_spec.rb b/spec/ruby/core/process/status/equal_value_spec.rb
index 9e9a2d0a2b..444ce1775b 100644
--- a/spec/ruby/core/process/status/equal_value_spec.rb
+++ b/spec/ruby/core/process/status/equal_value_spec.rb
@@ -1,5 +1,15 @@
require_relative '../../../spec_helper'
describe "Process::Status#==" do
- it "needs to be reviewed for spec completeness"
+ it "returns true when compared to the integer status of an exited child" do
+ ruby_exe("exit(29)")
+ $?.to_i.should == $?
+ $?.should == $?.to_i
+ end
+
+ it "returns true when compared to the integer status of a terminated child" do
+ ruby_exe("Process.kill(:KILL, $$); exit(29)")
+ $?.to_i.should == $?
+ $?.should == $?.to_i
+ end
end
diff --git a/spec/ruby/core/process/status/exitstatus_spec.rb b/spec/ruby/core/process/status/exitstatus_spec.rb
index cd46b2081f..d6c6965b9e 100644
--- a/spec/ruby/core/process/status/exitstatus_spec.rb
+++ b/spec/ruby/core/process/status/exitstatus_spec.rb
@@ -11,7 +11,7 @@ describe "Process::Status#exitstatus" do
describe "for a child that raised SignalException" do
before :each do
- ruby_exe("raise SignalException, 'SIGTERM'")
+ ruby_exe("Process.kill(:KILL, $$); exit(42)")
end
platform_is_not :windows do
diff --git a/spec/ruby/core/process/status/termsig_spec.rb b/spec/ruby/core/process/status/termsig_spec.rb
index 1482d27146..204708bc1b 100644
--- a/spec/ruby/core/process/status/termsig_spec.rb
+++ b/spec/ruby/core/process/status/termsig_spec.rb
@@ -1,9 +1,7 @@
require_relative '../../../spec_helper'
describe "Process::Status#termsig" do
-
describe "for a child that exited normally" do
-
before :each do
ruby_exe("exit(0)")
end
@@ -26,26 +24,20 @@ describe "Process::Status#termsig" do
end
describe "for a child that was sent a signal" do
-
before :each do
ruby_exe("Process.kill(:KILL, $$); exit(42)")
end
platform_is_not :windows do
-
it "returns the signal" do
$?.termsig.should == Signal.list["KILL"]
end
-
end
platform_is :windows do
-
it "always returns nil" do
$?.termsig.should be_nil
end
-
end
-
end
end
diff --git a/spec/ruby/core/process/status/to_i_spec.rb b/spec/ruby/core/process/status/to_i_spec.rb
index 37b7bdb1e4..a284f64f86 100644
--- a/spec/ruby/core/process/status/to_i_spec.rb
+++ b/spec/ruby/core/process/status/to_i_spec.rb
@@ -1,5 +1,13 @@
require_relative '../../../spec_helper'
describe "Process::Status#to_i" do
- it "needs to be reviewed for spec completeness"
+ it "returns an integer when the child exits" do
+ ruby_exe('exit 48')
+ $?.to_i.should be_an_instance_of(Integer)
+ end
+
+ it "returns an integer when the child is signaled" do
+ ruby_exe('raise SignalException, "TERM"')
+ $?.to_i.should be_an_instance_of(Integer)
+ end
end