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: 71599e9c53b5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 333aa86024d7
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Oct 7, 2015

  1. Copy the full SHA
    0b87f44 View commit details
  2. Copy the full SHA
    61f48e1 View commit details
  3. Copy the full SHA
    333aa86 View commit details
15 changes: 1 addition & 14 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -3573,20 +3573,7 @@ private RubyString getStringForPattern(IRubyObject obj) {
*/
private RubyRegexp getPattern(IRubyObject obj) {
if (obj instanceof RubyRegexp) return (RubyRegexp)obj;
return RubyRegexp.newRegexp(getRuntime(), getStringForPattern(obj).value);
}

private Regex getStringPattern19(Ruby runtime, IRubyObject obj) {
RubyString str = getStringForPattern(obj);
if (str.scanForCodeRange() == CR_BROKEN) {
throw runtime.newRegexpError("invalid multybyte character: " +
RegexpSupport.regexpDescription19(runtime, str.value, new RegexpOptions(), str.value.getEncoding()).toString());
}
if (str.value.getEncoding().isDummy()) {
throw runtime.newArgumentError("can't make regexp with dummy encoding");
}

return RubyRegexp.getQuotedRegexpFromCache19(runtime, str.value, new RegexpOptions(), str.isAsciiOnly());
return RubyRegexp.newRegexpFromStr(getRuntime(), getStringForPattern(obj), 0);
}

// MRI: get_pat_quoted
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# jruby/jruby#3267
# String passed to String#match was not following proper channels to compile to Regexp.
# As a result, encoding was not negotiated properly.
describe "A UTF-8 string matched against a US-ASCII string" do
it "compiles to regexp successfully" do
result = nil
expect(
lambda {result = "".force_encoding('US-ASCII').match("Període\\ de\\ retorn".force_encoding('UTF-8'))}
).not_to raise_error

expect(result).to eq(nil)
end
end
3 changes: 1 addition & 2 deletions test/mri/excludes/TestRegexp.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
exclude :test_char_class, "needs investigation"
exclude :test_dup_warn, "needs investigation"
exclude :test_eq_tilde_can_be_overridden, "needs investigation"
exclude :test_equal, "needs investigation"
exclude :test_initialize, "needs investigation"
exclude :test_invalid_escape_error, "needs investigation"
exclude :test_invalid_fragment, "needs investigation"
exclude :test_named_capture_nonascii, "needs investigation"
exclude :test_once_multithread, "needs investigation"
exclude :test_once_multithread, "fails intermittently"
exclude :test_options_in_look_behind, "needs investigation"
exclude :test_raw_hyphen_and_tk_char_type_after_range, "needs investigation"
exclude :test_regsub_K, "needs investigation"
2 changes: 0 additions & 2 deletions test/mri/excludes/TestString.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
exclude :test_count, "needs investigation"
exclude :test_eq_tilde_can_be_overridden, "needs investigation"
exclude :test_partition, "needs investigation"
exclude :test_regexp_match_subclass, "String subclass with overridden =~ should see obj =~ dispatch (#2157)"
exclude :test_rpartition, "needs investigation"
exclude :test_rstrip, "needs investigation"
exclude :test_to_i, "needs investigation"