Skip to content

Commit

Permalink
Add specs for Process::Status#>>
Browse files Browse the repository at this point in the history
They're pretty minimal, since the method is deprecated and will be
removed in Ruby 3.5. (Ruby 3.3 warns for removal in 3.4, but 3.4-dev
still has the method and warns for removal in 3.5)
  • Loading branch information
herwinw committed Nov 16, 2024
1 parent 2be9eab commit 9d2a586
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion core/process/status/right_shift_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
require_relative '../../../spec_helper'

describe "Process::Status#>>" do
it "needs to be reviewed for spec completeness"
it "returns a right shift of the integer status of an exited child" do
suppress_warning do
ruby_exe("exit(29)", exit_status: 29)
($? >> 0).should == $?.to_i
($? >> 1).should == $?.to_i >> 1

# Actual value is implementation specific
platform_is :linux do
($? >> 8).should == 29
end
end
end

ruby_version_is "3.3" do
it "raises an ArgumentError if shift value is negative" do
suppress_warning do
ruby_exe("exit(0)")
-> {
$? >> -1
}.should raise_error(ArgumentError, 'negative shift value: -1')
end
end

it "shows a deprecation warning" do
ruby_exe("exit(0)")
-> {
$? >> 0
}.should complain(/warning: Process::Status#>> is deprecated and will be removed .*use other Process::Status attributes instead/)
end
end
end

0 comments on commit 9d2a586

Please sign in to comment.