Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failling TestUTF16#test_succ #6252

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions core/src/main/java/org/jruby/util/StringSupport.java
Expand Up @@ -1442,11 +1442,19 @@ public static ByteList succCommon(ByteList original) {
if (!alnumSeen) {
s = end;
while ((s = enc.prevCharHead(bytes, p, s, end)) != -1) {
byte tmp[] = new byte[org.jcodings.Config.ENC_CODE_TO_MBC_MAXLEN];
int cl = preciseLength(enc, bytes, s, end);
if (cl <= 0) continue;
neighbor = succChar(enc, bytes, s, cl);
if (neighbor == NeighborChar.FOUND) return valueCopy;
if (preciseLength(enc, bytes, s, s + 1) != cl) succChar(enc, bytes, s, cl); /* wrapped to \0...\0. search next valid char. */
System.arraycopy(bytes, s, tmp, 0, cl);
neighbor = succChar(enc, tmp, 0, cl);
if (neighbor == NeighborChar.FOUND) {
System.arraycopy(tmp, 0, bytes, s, cl);
return valueCopy;
}
if (neighbor == NeighborChar.WRAPPED) {
System.arraycopy(tmp, 0, bytes, s, cl);
}
if (preciseLength(enc, bytes, s, s + cl) != cl) succChar(enc, bytes, s, cl); /* wrapped to \0...\0. search next valid char. */
if (!enc.isAsciiCompatible()) {
System.arraycopy(bytes, s, carry, 0, cl);
carryLen = cl;
Expand Down
1 change: 0 additions & 1 deletion test/mri/excludes/TestUTF16.rb
@@ -1,3 +1,2 @@
exclude :test_regexp_union, "needs investigation"
exclude :test_succ, "very slow...takes 40 seconds"
exclude :test_sym_eq, "needs investigation"