diff options
author | Hiroshi SHIBATA <[email protected]> | 2024-12-24 15:27:57 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-12-25 20:10:18 +0900 |
commit | 9967eccc54017110845d3805143ab2e87a0e2393 (patch) | |
tree | aed7f797ba4c7dd6d9084e720e3c161f9f1aae2a /spec/ruby/core | |
parent | 8f11d6cbe2e86d5e6f80911024630aa0d3685332 (diff) |
Removed Process::Status#& and Process::Status#>>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12452
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/process/status/bit_and_spec.rb | 49 | ||||
-rw-r--r-- | spec/ruby/core/process/status/right_shift_spec.rb | 47 |
2 files changed, 51 insertions, 45 deletions
diff --git a/spec/ruby/core/process/status/bit_and_spec.rb b/spec/ruby/core/process/status/bit_and_spec.rb index f4a4328907..6a29988da2 100644 --- a/spec/ruby/core/process/status/bit_and_spec.rb +++ b/spec/ruby/core/process/status/bit_and_spec.rb @@ -1,35 +1,38 @@ require_relative '../../../spec_helper' -describe "Process::Status#&" do - it "returns a bitwise and of the integer status of an exited child" do - suppress_warning do - ruby_exe("exit(29)", exit_status: 29) - ($? & 0).should == 0 - ($? & $?.to_i).should == $?.to_i +ruby_version_is ""..."3.5" do - # Actual value is implementation specific - platform_is :linux do - # 29 == 0b11101 - ($? & 0b1011100000000).should == 0b1010100000000 + describe "Process::Status#&" do + it "returns a bitwise and of the integer status of an exited child" do + suppress_warning do + ruby_exe("exit(29)", exit_status: 29) + ($? & 0).should == 0 + ($? & $?.to_i).should == $?.to_i + + # Actual value is implementation specific + platform_is :linux do + # 29 == 0b11101 + ($? & 0b1011100000000).should == 0b1010100000000 + end end end - end - ruby_version_is "3.3" do - it "raises an ArgumentError if mask is negative" do - suppress_warning do + ruby_version_is "3.3" do + it "raises an ArgumentError if mask is negative" do + suppress_warning do + ruby_exe("exit(0)") + -> { + $? & -1 + }.should raise_error(ArgumentError, 'negative mask value: -1') + end + end + + it "shows a deprecation warning" do ruby_exe("exit(0)") -> { - $? & -1 - }.should raise_error(ArgumentError, 'negative mask value: -1') + $? & 0 + }.should complain(/warning: Process::Status#& is deprecated and will be removed .*use other Process::Status predicates instead/) 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 predicates instead/) - end end end diff --git a/spec/ruby/core/process/status/right_shift_spec.rb b/spec/ruby/core/process/status/right_shift_spec.rb index 034ce348cb..af2cd2a4b3 100644 --- a/spec/ruby/core/process/status/right_shift_spec.rb +++ b/spec/ruby/core/process/status/right_shift_spec.rb @@ -1,34 +1,37 @@ require_relative '../../../spec_helper' -describe "Process::Status#>>" do - 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 +ruby_version_is ""..."3.5" do - # Actual value is implementation specific - platform_is :linux do - ($? >> 8).should == 29 + describe "Process::Status#>>" do + 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 - end - ruby_version_is "3.3" do - it "raises an ArgumentError if shift value is negative" do - suppress_warning do + 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)") -> { - $? >> -1 - }.should raise_error(ArgumentError, 'negative shift value: -1') + $? >> 0 + }.should complain(/warning: Process::Status#>> is deprecated and will be removed .*use other Process::Status attributes instead/) 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 |