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: 1b99cd39ba4e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 153f62356a0a
Choose a head ref
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 9, 2018

  1. Add specs for alias Set#=== to #include?

    from 2aee703e7a29bcfc2095e40870f5a3c45cd96dd2.
    ChrisBr committed Jan 9, 2018
    Copy the full SHA
    9922da3 View commit details
  2. Add MRI test for alias Set#=== to include?

    from 2aee703e7a29bcfc2095e40870f5a3c45cd96dd2.
    ChrisBr committed Jan 9, 2018
    Copy the full SHA
    2f7d4ff View commit details
  3. Copy the full SHA
    2799bfe View commit details

Commits on Jan 10, 2018

  1. Merge pull request #4954 from ChrisBr/feature/set-equal

    Alias Set#=== to #include?
    kares authored Jan 10, 2018
    Copy the full SHA
    153f623 View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/set/RubySet.java
Original file line number Diff line number Diff line change
@@ -466,7 +466,7 @@ public IRubyObject flatten_bang(final ThreadContext context) {
/**
* Returns true if the set contains the given object.
*/
@JRubyMethod(name = "include?", alias = { "member?" })
@JRubyMethod(name = "include?", alias = { "member?", "===" })
public RubyBoolean include_p(final ThreadContext context, IRubyObject obj) {
return context.runtime.newBoolean( containsImpl(obj) );
}
7 changes: 7 additions & 0 deletions spec/ruby/core/set/case_equality_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/include', __FILE__)
require 'set'

describe "Set#===" do
it_behaves_like :set_include, :===
end
7 changes: 7 additions & 0 deletions spec/ruby/core/set/sortedset/case_equality_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../shared/include', __FILE__)
require 'set'

describe "SortedSet#===" do
it_behaves_like :sorted_set_include, :===
end
17 changes: 17 additions & 0 deletions test/mri/test_set.rb
Original file line number Diff line number Diff line change
@@ -200,6 +200,23 @@ def test_include?
assert_equal(false, set.include?(true))
end

def test_eqq
set = Set[1,2,3]

assert_equal(true, set === 1)
assert_equal(true, set === 2)
assert_equal(true, set === 3)
assert_equal(false, set === 0)
assert_equal(false, set === nil)

set = Set["1",nil,"2",nil,"0","1",false]
assert_equal(true, set === nil)
assert_equal(true, set === false)
assert_equal(true, set === "1")
assert_equal(false, set === 0)
assert_equal(false, set === true)
end

def test_superset?
set = Set[1,2,3]