mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix remaining tests for java.util.regex
This commit is contained in:
parent
ec463124c9
commit
4641f9ca87
|
@ -183,7 +183,7 @@ class TMatchResultImpl implements TMatchResult {
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
if (group < 0 || group > groupCount) {
|
||||
if (group < 0 || group >= groupCount) {
|
||||
throw new IndexOutOfBoundsException(String.valueOf(group));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,6 +131,9 @@ public final class TMatcher implements TMatchResult {
|
|||
}
|
||||
|
||||
if (nextBackSlashed) {
|
||||
if (index >= repl.length) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
res.append(repl[index]);
|
||||
nextBackSlashed = false;
|
||||
} else {
|
||||
|
@ -158,8 +161,6 @@ public final class TMatcher implements TMatchResult {
|
|||
replacementPos += group.length();
|
||||
res.append(group);
|
||||
|
||||
} catch (IndexOutOfBoundsException iob) {
|
||||
throw iob;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("");
|
||||
}
|
||||
|
@ -316,10 +317,6 @@ public final class TMatcher implements TMatchResult {
|
|||
*/
|
||||
@Override
|
||||
public String group(int group) {
|
||||
if (group < 0 || group > matchResult.groupCount()) {
|
||||
throw new IndexOutOfBoundsException("Index " + group + " if out of range [0; " +
|
||||
matchResult.groupCount() + ")");
|
||||
}
|
||||
return matchResult.group(group);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,17 +16,17 @@
|
|||
|
||||
package org.teavm.classlib.java.util.regex;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import org.junit.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests Pattern compilation modes and modes triggered in pattern strings
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
public class ModeTest extends TestCase {
|
||||
public class ModeTest {
|
||||
@Test
|
||||
public void testCase() throws PatternSyntaxException {
|
||||
Pattern p;
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
|
||||
package org.teavm.classlib.java.util.regex;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.regex.Pattern;
|
||||
import org.junit.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Test boundary and error conditions in java.util.regex.Pattern
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
public class PatternErrorTest extends TestCase {
|
||||
public class PatternErrorTest {
|
||||
@Test
|
||||
public void testCompileErrors() throws Exception {
|
||||
// null regex string - should get NullPointerException
|
||||
|
|
|
@ -16,17 +16,17 @@
|
|||
|
||||
package org.teavm.classlib.java.util.regex;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import org.junit.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
/**
|
||||
* TODO Type description
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
public class PatternSyntaxExceptionTest extends TestCase {
|
||||
public class PatternSyntaxExceptionTest {
|
||||
@Test
|
||||
public void testCase() {
|
||||
String regex = "(";
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
|||
import java.util.regex.PatternSyntaxException;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PatternTest {
|
||||
public class PatternTest {
|
||||
String[] testPatterns = {
|
||||
"(a|b)*abb",
|
||||
"(1*2*3*4*)*567",
|
||||
|
|
|
@ -23,9 +23,6 @@ import java.util.regex.Pattern;
|
|||
import java.util.regex.PatternSyntaxException;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* TODO Type description
|
||||
*/
|
||||
public class SplitTest {
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue
Block a user