Skip to content

Commit

Permalink
Fix test_byteslice in test:mri (more readily mark substrings cr to un…
Browse files Browse the repository at this point in the history
…known)
  • Loading branch information
enebo committed Apr 18, 2015
1 parent 5e5168f commit 1248492
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions core/src/main/java/org/jruby/RubyString.java
Expand Up @@ -240,18 +240,15 @@ public final boolean isBrokenString() {
}

private void copyCodeRangeForSubstr(RubyString from, Encoding enc) {
int fromCr = from.getCodeRange();
if (fromCr == CR_7BIT) {
setCodeRange(fromCr);
} else if (fromCr == CR_VALID) {
if (!enc.isAsciiCompatible() || searchNonAscii(value) != -1) {
setCodeRange(CR_VALID);

if (value.getRealSize() == 0) {
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
} else {
int fromCr = from.getCodeRange();
if (fromCr == CR_7BIT) {
setCodeRange(fromCr);
} else {
setCodeRange(CR_7BIT);
}
} else{
if (value.getRealSize() == 0) {
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
setCodeRange(CR_UNKNOWN);
}
}
}
Expand Down

0 comments on commit 1248492

Please sign in to comment.