Skip to content

Commit 7339d54

Browse files
herbyderbysjamesr
authored andcommitted
Minor test fixes to enable running internally with Blaze.
PiperOrigin-RevId: 574899560
1 parent 10ba78d commit 7339d54

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

javatests/com/google/re2j/CharClassTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
package com.google.re2j;
88

99
import static com.google.re2j.Utils.stringToRunes;
10-
1110
import static org.junit.Assert.assertEquals;
1211

1312
import java.util.Arrays;
14-
1513
import org.junit.Test;
14+
import org.junit.runner.RunWith;
15+
import org.junit.runners.JUnit4;
1616

17+
@RunWith(JUnit4.class)
1718
public class CharClassTest {
1819

1920
private static CharClass cc(int... x) {

javatests/com/google/re2j/ParserTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@
2121
import static org.junit.Assert.assertEquals;
2222
import static org.junit.Assert.fail;
2323

24+
import com.google.common.truth.Truth;
2425
import java.util.ArrayList;
2526
import java.util.EnumMap;
2627
import java.util.Map;
27-
28-
import com.google.common.truth.Truth;
2928
import org.junit.Test;
29+
import org.junit.runner.RunWith;
30+
import org.junit.runners.JUnit4;
3031

3132
/**
3233
* @author [email protected] (Alan Donovan)
3334
*/
35+
@RunWith(JUnit4.class)
3436
public class ParserTest {
3537

3638
private interface RunePredicate {
@@ -405,6 +407,8 @@ private static void dumpRegexp(StringBuilder b, Regexp re) {
405407
}
406408
b.append('{');
407409
switch (re.op) {
410+
default:
411+
break;
408412
case END_TEXT:
409413
if ((re.flags & WAS_DOLLAR) == 0) {
410414
b.append("\\z");
@@ -583,7 +587,7 @@ public void testParseInvalidRegexps() throws PatternSyntaxException {
583587
}
584588
}
585589
for (String regexp : ONLY_PERL) {
586-
Parser.parse(regexp, PERL);
590+
Regexp unused = Parser.parse(regexp, PERL);
587591
try {
588592
Regexp re = Parser.parse(regexp, POSIX);
589593
fail("parsing (POSIX) " + regexp + " should have failed, instead got " + dump(re));
@@ -598,7 +602,7 @@ public void testParseInvalidRegexps() throws PatternSyntaxException {
598602
} catch (PatternSyntaxException e) {
599603
/* ok */
600604
}
601-
Parser.parse(regexp, POSIX);
605+
Regexp unused = Parser.parse(regexp, POSIX);
602606
}
603607
}
604608

javatests/com/google/re2j/RE2CompileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public RE2CompileTest(String input, String expectedError) {
6767
@Test
6868
public void testCompile() {
6969
try {
70-
RE2.compile(input);
70+
RE2 unused = RE2.compile(input);
7171
if (expectedError != null) {
7272
fail("RE2.compile(" + input + ") was successful, expected " + expectedError);
7373
}

javatests/com/google/re2j/RE2Test.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99

1010
package com.google.re2j;
1111

12-
import java.util.Arrays;
13-
import org.junit.Test;
14-
1512
import static org.junit.Assert.assertFalse;
1613
import static org.junit.Assert.assertTrue;
1714

15+
import java.util.Arrays;
16+
import org.junit.Test;
17+
import org.junit.runner.RunWith;
18+
import org.junit.runners.JUnit4;
19+
1820
/** Tests of RE2 API. */
21+
@RunWith(JUnit4.class)
1922
public class RE2Test {
2023
@Test
2124
public void testFullMatch() {

javatests/com/google/re2j/UnicodeTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
*/
77
package com.google.re2j;
88

9-
import org.junit.Test;
9+
import static org.junit.Assert.*;
1010

1111
import java.util.ArrayList;
1212
import java.util.List;
13+
import org.junit.Test;
14+
import org.junit.runner.RunWith;
15+
import org.junit.runners.JUnit4;
1316

14-
import static org.junit.Assert.*;
15-
17+
@RunWith(JUnit4.class)
1618
public class UnicodeTest {
1719

1820
@Test

0 commit comments

Comments
 (0)