Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fad62e6af3fb
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 48bdef6d5a7c
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on May 10, 2016

  1. Squashed 'spec/mspec/' changes from f509c1a..8ed21cb

    8ed21cb Inspect the object returned when no exception is raised in a raise_error
    
    git-subtree-dir: spec/mspec
    git-subtree-split: 8ed21cb74171ff6b45fa128d1a57c8391df1f824
    eregon committed May 10, 2016
    Copy the full SHA
    de3c9ba View commit details
  2. Copy the full SHA
    f12c90d View commit details
  3. Squashed 'spec/ruby/' changes from 32e22d6..5c54bc7

    5c54bc7 Only expect trunk to be fixed at the moment
    e1be438 Add a spec for the normal case of not giving superclass
    5fc9d91 Add a spec for MRI Bug #12367
    3b5429c Add a few specs about mismatching superclass and its evaluation in class expressions
    8c47186 Specs for Array#min and Array#max with single-argument block.
    2d068df Spec that struct-class duping produces identical method tables.
    f6c074a Add a simpler and smaller example in Array#sort
    ea625ce Merge pull request #253 from odaira/myContribution
    11fcd26 AIX does not support RLIMIT_MEMLOCK
    86f2466 Merge pull request #252 from odaira/myContribution
    4d26279 setgroups() in AIX allows a non-root process to set its primary group ID
    f692dcb Merge pull request #251 from odaira/myContribution
    e926b64 AIX allows a non-root process to call setgroups()
    6036043 Merge pull request #250 from odaira/myContribution
    5e31cf6 Call Process.getrlimit(:DATA) once before the tests to get a consistent returned value in subsequent calls on AIX
    
    git-subtree-dir: spec/ruby
    git-subtree-split: 5c54bc74b6c22abb5dc081aaa190866ca4abf7d8
    eregon committed May 10, 2016
    Copy the full SHA
    f022830 View commit details
  4. Copy the full SHA
    48bdef6 View commit details
2 changes: 1 addition & 1 deletion spec/mspec/lib/mspec/matchers/raise_error.rb
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ def failure_message
if @actual then
message << "but got #{format_exception(@actual)}"
else
message << "but no exception was raised (#{@result} was returned)"
message << "but no exception was raised (#{@result.pretty_inspect.chomp} was returned)"
end

message
8 changes: 8 additions & 0 deletions spec/mspec/spec/matchers/raise_error_spec.rb
Original file line number Diff line number Diff line change
@@ -82,6 +82,14 @@ class UnexpectedException < Exception; end
["Expected ExpectedException (expected)", "but no exception was raised (120 was returned)"]
end

it "provides a useful failure message when no exception is raised and nil is returned" do
proc = Proc.new { nil }
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
matcher.matches?(proc)
matcher.failure_message.should ==
["Expected ExpectedException (expected)", "but no exception was raised (nil was returned)"]
end

it "provides a useful negative failure message" do
proc = Proc.new { raise ExpectedException, "expected" }
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
11 changes: 11 additions & 0 deletions spec/ruby/core/process/getrlimit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
require File.expand_path('../../../spec_helper', __FILE__)

platform_is :aix do
# In AIX, if getrlimit(2) is called multiple times with RLIMIT_DATA,
# the first call and the subequent calls return slightly different
# values of rlim_cur, even if the process does nothing between
# the calls. This behavior causes some of the tests in this spec
# to fail, so call Process.getrlimit(:DATA) once and discard the result.
# Subsequent calls to Process.getrlimit(:DATA) should return
# a consistent value of rlim_cur.
Process.getrlimit(:DATA)
end

platform_is_not :windows do
describe "Process.getrlimit" do
it "returns a two-element Array of Integers" do
25 changes: 24 additions & 1 deletion spec/ruby/core/process/groups_spec.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,30 @@
Process.groups = groups
Process.groups.sort.should == groups.sort
else
lambda { Process.groups = [] }.should raise_error(Errno::EPERM)
platform_is :aix do
# setgroups() is not part of the POSIX standard,
# so its behavior varies from OS to OS. AIX allows a non-root
# process to set the supplementary group IDs, as long as
# they are presently in its supplementary group IDs.
# The order of the following tests matters.
# After this process executes "Process.groups = []"
# it should no longer be able to set any supplementary
# group IDs, even if it originally belonged to them.
# It should only be able to set its primary group ID.
Process.groups = groups
Process.groups.sort.should == groups.sort
Process.groups = []
Process.groups.should == []
Process.groups = [ Process.gid ]
Process.groups.should == [ Process.gid ]
supplementary = groups - [ Process.gid ]
if supplementary.length > 0
lambda { Process.groups = supplementary }.should raise_error(Errno::EPERM)
end
end
platform_is_not :aix do
lambda { Process.groups = [] }.should raise_error(Errno::EPERM)
end
end
end
end
12 changes: 8 additions & 4 deletions spec/ruby/core/process/setrlimit_spec.rb
Original file line number Diff line number Diff line change
@@ -74,8 +74,10 @@
end

platform_is_not :solaris do
it "coerces :MEMLOCK into RLIMIT_MEMLOCK" do
Process.setrlimit(:MEMLOCK, *Process.getrlimit(Process::RLIMIT_MEMLOCK)).should be_nil
platform_is_not :aix do
it "coerces :MEMLOCK into RLIMIT_MEMLOCK" do
Process.setrlimit(:MEMLOCK, *Process.getrlimit(Process::RLIMIT_MEMLOCK)).should be_nil
end
end

it "coerces :NPROC into RLIMIT_NPROC" do
@@ -154,8 +156,10 @@
end

platform_is_not :solaris do
it "coerces 'MEMLOCK' into RLIMIT_MEMLOCK" do
Process.setrlimit("MEMLOCK", *Process.getrlimit(Process::RLIMIT_MEMLOCK)).should be_nil
platform_is_not :aix do
it "coerces 'MEMLOCK' into RLIMIT_MEMLOCK" do
Process.setrlimit("MEMLOCK", *Process.getrlimit(Process::RLIMIT_MEMLOCK)).should be_nil
end
end

it "coerces 'NPROC' into RLIMIT_NPROC" do
24 changes: 13 additions & 11 deletions spec/ruby/language/class_spec.rb
Original file line number Diff line number Diff line change
@@ -88,17 +88,19 @@ class SuperclassReopenedBasicObject < BasicObject
end

# [Bug #12367] [ruby-core:75446]
it "raises an error when reopening a class with Object as superclass" do
module ClassSpecs
class SuperclassReopenedObject < A
end
SuperclassReopenedObject.superclass.should == A

lambda {
class SuperclassReopenedObject < Object
ruby_version_is "2.4" do # Until backported
it "raises an error when reopening a class with Object as superclass" do
module ClassSpecs
class SuperclassReopenedObject < A
end
}.should raise_error(TypeError, /superclass mismatch/)
SuperclassReopenedObject.superclass.should == A
SuperclassReopenedObject.superclass.should == A

lambda {
class SuperclassReopenedObject < Object
end
}.should raise_error(TypeError, /superclass mismatch/)
SuperclassReopenedObject.superclass.should == A
end
end
end

@@ -110,7 +112,7 @@ class SuperclassNotGiven < A

class SuperclassNotGiven
end
SuperclassReopenedObject.superclass.should == A
SuperclassNotGiven.superclass.should == A
end
end