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

Commits on Jan 6, 2018

  1. Copy the full SHA
    830f1b8 View commit details
  2. Copy the full SHA
    3340763 View commit details
  3. Add #test_create to test targets

    Currently `#test_create` does not fail.
    yui-knk committed Jan 6, 2018
    Copy the full SHA
    dc29c7e View commit details

Commits on Jan 8, 2018

  1. Merge pull request #4947 from yui-knk/Hash_test_create

    Fix RubyHash to pass `#test_create`
    enebo authored Jan 8, 2018
    Copy the full SHA
    2e8201f View commit details
Showing with 8 additions and 3 deletions.
  1. +8 −2 core/src/main/java/org/jruby/RubyHash.java
  2. +0 −1 test/mri/excludes/TestHash.rb
10 changes: 8 additions & 2 deletions core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -165,14 +165,20 @@ public static IRubyObject create(ThreadContext context, IRubyObject recv, IRubyO
hash = (RubyHash)klass.allocate();
RubyArray arr = (RubyArray)tmp;
for(int i = 0, j = arr.getLength(); i<j; i++) {
IRubyObject v = TypeConverter.convertToTypeWithCheck(arr.entry(i), runtime.getArray(), "to_ary");
IRubyObject e = arr.entry(i);
IRubyObject v = TypeConverter.convertToTypeWithCheck(e, runtime.getArray(), "to_ary");
IRubyObject key;
IRubyObject val = runtime.getNil();
if(v.isNil()) {
runtime.getWarnings().warn("wrong element type " + e.getMetaClass() + " at " + i + " (expected array)");
runtime.getWarnings().warn("ignoring wrong elements is deprecated, remove them explicitly");
runtime.getWarnings().warn("this causes ArgumentError in the next release");
continue;
}
switch(((RubyArray)v).getLength()) {
case 2:
default:
throw runtime.newArgumentError("invalid number of elements (" + ((RubyArray)v).getLength() + " for 1..2)");
case 2:
val = ((RubyArray)v).entry(1);
case 1:
key = ((RubyArray)v).entry(0);
1 change: 0 additions & 1 deletion test/mri/excludes/TestHash.rb
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
exclude :test_callcc_escape, "needs investigation"
exclude :test_callcc_iter_level, "needs investigation"
exclude :test_callcc_reenter, "needs investigation"
exclude :test_create, "needs investigation"
exclude :test_eql, "needs investigation"
exclude :test_exception_in_rehash, "needs investigation"
exclude :test_fetch_error, "needs investigation"