[jruby-joni] 128/279: Fix EXACTMBN opcode selection and add a test.
Hideki Yamane
henrich at moszumanska.debian.org
Mon Nov 16 11:27:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository jruby-joni.
commit 9a75aca1c7d235e53ea8f07cae5f764c4c1ec76a
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Sat Mar 10 20:33:12 2012 +0100
Fix EXACTMBN opcode selection and add a test.
---
src/org/joni/ArrayCompiler.java | 3 ++-
test/org/joni/test/Test.java | 4 ++++
test/org/joni/test/TestU8.java | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/org/joni/ArrayCompiler.java b/src/org/joni/ArrayCompiler.java
index f8825aa..cbeec20 100644
--- a/src/org/joni/ArrayCompiler.java
+++ b/src/org/joni/ArrayCompiler.java
@@ -148,6 +148,7 @@ final class ArrayCompiler extends Compiler {
break;
case 3:
op = OPCode.EXACTMB3N;
+ break;
default:
op = OPCode.EXACTMBN;
} // switch
@@ -191,10 +192,10 @@ final class ArrayCompiler extends Compiler {
// string length, template index, template string pointer
len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
} else {
- if (op == OPCode.EXACTMBN) len += OPSize.LENGTH;
if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH;
len += mbLength * strLength;
}
+ if (op == OPCode.EXACTMBN) len += OPSize.LENGTH;
return len;
}
diff --git a/test/org/joni/test/Test.java b/test/org/joni/test/Test.java
index e8efea5..a70f191 100644
--- a/test/org/joni/test/Test.java
+++ b/test/org/joni/test/Test.java
@@ -132,6 +132,10 @@ public abstract class Test {
xx(pattern, str, 0, 0, 0, true);
}
+ protected void n(byte[]pattern, byte[]str, int option) {
+ xx(pattern, str, 0, 0, 0, true, option);
+ }
+
public void xxs(String pattern, String str, int from, int to, int mem, boolean not) {
xxs(pattern, str, from, to, mem, not, option());
}
diff --git a/test/org/joni/test/TestU8.java b/test/org/joni/test/TestU8.java
index ec51c0f..e3d5b11 100644
--- a/test/org/joni/test/TestU8.java
+++ b/test/org/joni/test/TestU8.java
@@ -58,6 +58,11 @@ public class TestU8 extends Test {
x2s("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35, Option.IGNORECASE);
x2s("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 35, Option.IGNORECASE);
x2s("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAA", 0, 35, Option.IGNORECASE);
+
+ pat = new byte[]{94, 40, (byte)239, (byte)188, (byte)161, 41, 92, 49, 36};
+ str = new byte[]{(byte)239, (byte)188, (byte)161, 65};
+
+ n(pat, str, Option.IGNORECASE);
}
public static void main(String[] args) throws Throwable {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git
More information about the pkg-java-commits
mailing list