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 dc125d428ee894714448c81ddbe6edd36ebd838e Author: lopex <[email protected]> Date: Fri Feb 2 10:41:18 2018 +0100 errors / syntax errors tests --- test/org/joni/test/Test.java | 16 ++++++++++ test/org/joni/test/TestError.java | 63 +++++++++++++++++++++++++++++++++++++++ test/org/joni/test/TestU8.java | 2 -- 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/test/org/joni/test/Test.java b/test/org/joni/test/Test.java index b394de9..2412e12 100644 --- a/test/org/joni/test/Test.java +++ b/test/org/joni/test/Test.java @@ -72,6 +72,22 @@ public abstract class Test { } } + public void xerrs(String pattern, String msg) throws Exception { + xerr(pattern.getBytes(testEncoding()), msg, option()); + } + + public void xerrs(String pattern, String msg, int option) throws Exception { + xerr(pattern.getBytes(testEncoding()), msg, option); + } + + public void xerr(byte[] pattern, String msg, int option) throws Exception { + try { + new Regex(pattern, 0, length(pattern), option, encoding(), syntax(), WarnCallback.NONE); + } catch (JOniException je) { + assertEquals(je.getMessage(), msg); + } + } + public void xx(byte[] pattern, byte[] str, int from, int to, int mem, boolean not) throws InterruptedException { xx(pattern, str, from, to, mem, not, option()); } diff --git a/test/org/joni/test/TestError.java b/test/org/joni/test/TestError.java new file mode 100755 index 0000000..4276174 --- /dev/null +++ b/test/org/joni/test/TestError.java @@ -0,0 +1,63 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package org.joni.test; + +import org.joni.Option; +import org.joni.Syntax; +import org.joni.exception.ErrorMessages; +import org.jcodings.Encoding; +import org.jcodings.specific.ASCIIEncoding; + +public class TestError extends Test { + @Override + public int option() { + return Option.DEFAULT; + } + + @Override + public Encoding encoding() { + return ASCIIEncoding.INSTANCE; + } + + @Override + public String testEncoding() { + return "iso-8859-2"; + } + + @Override + public Syntax syntax() { + return Syntax.TEST; + } + + @Override + public void test() throws Exception { + xerrs("(", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + xerrs("(0?0|(?(1)||)|(?(1)||))?", ErrorMessages.ERR_INVALID_CONDITION_PATTERN); + // xerrs("[\\40000000000", ErrorMessages.ERR_TOO_BIG_NUMBER); + // xerrs("[\\40000000000\n", ErrorMessages.ERR_TOO_BIG_NUMBER); + xerrs("[]", ErrorMessages.ERR_EMPTY_CHAR_CLASS); + xerrs("[c-a]", ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); + xerrs("\\x{FFFFFFFF}", ErrorMessages.ERR_TOO_BIG_WIDE_CHAR_VALUE); + xerrs("\\x{100000000}", ErrorMessages.ERR_TOO_LONG_WIDE_CHAR_VALUE); + // xerrs("\\u026x", ErrorMessages.ERR_TOO_SHORT_DIGITS); + xerrs("()(?\\!(?'a')\\1)", ErrorMessages.ERR_UNDEFINED_GROUP_OPTION); + xerrs("\\((", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + } +} diff --git a/test/org/joni/test/TestU8.java b/test/org/joni/test/TestU8.java index f933765..6500930 100755 --- a/test/org/joni/test/TestU8.java +++ b/test/org/joni/test/TestU8.java @@ -19,8 +19,6 @@ */ package org.joni.test; -import java.util.Arrays; - import org.jcodings.Encoding; import org.jcodings.specific.UTF8Encoding; import org.joni.Option; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

