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

Commits on May 22, 2016

  1. Copy the full SHA
    47a9386 View commit details
  2. Copy the full SHA
    8847b78 View commit details

Commits on May 26, 2016

  1. Merge pull request #3912 from MSNexploder/string_tests

    fix four additional MRI string tests
    headius committed May 26, 2016
    Copy the full SHA
    4d9c129 View commit details
Showing with 9 additions and 11 deletions.
  1. +9 −8 core/src/main/java/org/jruby/RubyString.java
  2. +0 −3 test/mri/excludes/TestString.rb
17 changes: 9 additions & 8 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -3388,6 +3388,10 @@ public IRubyObject stringToInum(int base, boolean badcheck) {

public IRubyObject stringToInum19(int base, boolean badcheck) {
ByteList s = this.value;
if (!s.getEncoding().isAsciiCompatible()) {
throw getRuntime().newEncodingCompatibilityError("ASCII incompatible encoding: " + s.getEncoding());
}

return ConvertBytes.byteListToInum19(getRuntime(), s, base, badcheck);
}

@@ -3400,9 +3404,6 @@ public IRubyObject oct(ThreadContext context) {

@JRubyMethod(name = "oct")
public IRubyObject oct19(ThreadContext context) {
if (!value.getEncoding().isAsciiCompatible()) {
throw context.runtime.newEncodingCompatibilityError("ASCII incompatible encoding: " + value.getEncoding());
}
return stringToInum19(-8, false);
}

@@ -3415,9 +3416,6 @@ public IRubyObject hex(ThreadContext context) {

@JRubyMethod(name = "hex")
public IRubyObject hex19(ThreadContext context) {
if (!value.getEncoding().isAsciiCompatible()) {
throw context.runtime.newEncodingCompatibilityError("ASCII incompatible encoding: " + value.getEncoding());
}
return stringToInum19(16, false);
}

@@ -4119,7 +4117,8 @@ public IRubyObject partition(ThreadContext context, IRubyObject arg, Block block
}

private IRubyObject partitionMismatch(Ruby runtime) {
return RubyArray.newArray(runtime, new IRubyObject[]{this, newEmptyString(runtime), newEmptyString(runtime)});
final Encoding enc = getEncoding();
return RubyArray.newArray(runtime, new IRubyObject[]{this, newEmptyString(runtime, enc), newEmptyString(runtime, enc)});
}

@JRubyMethod(name = "rpartition", reads = BACKREF, writes = BACKREF)
@@ -4149,7 +4148,8 @@ public IRubyObject rpartition(ThreadContext context, IRubyObject arg) {
}

private IRubyObject rpartitionMismatch(Ruby runtime) {
return RubyArray.newArray(runtime, new IRubyObject[]{newEmptyString(runtime), newEmptyString(runtime), this});
final Encoding enc = getEncoding();
return RubyArray.newArray(runtime, new IRubyObject[]{newEmptyString(runtime, enc), newEmptyString(runtime, enc), this});
}

/** rb_str_chop / rb_str_chop_bang
@@ -4417,6 +4417,7 @@ public IRubyObject rstrip_bang19(ThreadContext context) {
return runtime.getNil();
}

checkDummyEncoding();
Encoding enc = EncodingUtils.STR_ENC_GET(this);
IRubyObject result = singleByteOptimizable(enc) ?
singleByteRStrip19(runtime) : multiByteRStrip19(runtime, context);
3 changes: 0 additions & 3 deletions test/mri/excludes/TestString.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
exclude :test_partition, "needs investigation"
exclude :test_rpartition, "needs investigation"
exclude :test_rstrip, "needs investigation"
exclude :test_to_i, "needs investigation"
exclude :test_crypt, "does not raise as expected"
exclude :test_setter, "does not raise as expected"
exclude :test_split_invalid_argument, "raises NoMethodError: undefined method `respond_to?' for #<BasicObject:0x7ff7a4d7>"