Skip to content

Commit

Permalink
Minor test fixes to enable running internally with Blaze.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 574899560
  • Loading branch information
herbyderby authored and sjamesr committed Oct 24, 2023
1 parent 10ba78d commit 7339d54
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
5 changes: 3 additions & 2 deletions javatests/com/google/re2j/CharClassTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
package com.google.re2j;

import static com.google.re2j.Utils.stringToRunes;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class CharClassTest {

private static CharClass cc(int... x) {
Expand Down
12 changes: 8 additions & 4 deletions javatests/com/google/re2j/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import com.google.common.truth.Truth;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.Map;

import com.google.common.truth.Truth;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* @author [email protected] (Alan Donovan)
*/
@RunWith(JUnit4.class)
public class ParserTest {

private interface RunePredicate {
Expand Down Expand Up @@ -405,6 +407,8 @@ private static void dumpRegexp(StringBuilder b, Regexp re) {
}
b.append('{');
switch (re.op) {
default:
break;
case END_TEXT:
if ((re.flags & WAS_DOLLAR) == 0) {
b.append("\\z");
Expand Down Expand Up @@ -583,7 +587,7 @@ public void testParseInvalidRegexps() throws PatternSyntaxException {
}
}
for (String regexp : ONLY_PERL) {
Parser.parse(regexp, PERL);
Regexp unused = Parser.parse(regexp, PERL);
try {
Regexp re = Parser.parse(regexp, POSIX);
fail("parsing (POSIX) " + regexp + " should have failed, instead got " + dump(re));
Expand All @@ -598,7 +602,7 @@ public void testParseInvalidRegexps() throws PatternSyntaxException {
} catch (PatternSyntaxException e) {
/* ok */
}
Parser.parse(regexp, POSIX);
Regexp unused = Parser.parse(regexp, POSIX);
}
}

Expand Down
2 changes: 1 addition & 1 deletion javatests/com/google/re2j/RE2CompileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public RE2CompileTest(String input, String expectedError) {
@Test
public void testCompile() {
try {
RE2.compile(input);
RE2 unused = RE2.compile(input);
if (expectedError != null) {
fail("RE2.compile(" + input + ") was successful, expected " + expectedError);
}
Expand Down
9 changes: 6 additions & 3 deletions javatests/com/google/re2j/RE2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

package com.google.re2j;

import java.util.Arrays;
import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests of RE2 API. */
@RunWith(JUnit4.class)
public class RE2Test {
@Test
public void testFullMatch() {
Expand Down
8 changes: 5 additions & 3 deletions javatests/com/google/re2j/UnicodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
*/
package com.google.re2j;

import org.junit.Test;
import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import static org.junit.Assert.*;

@RunWith(JUnit4.class)
public class UnicodeTest {

@Test
Expand Down

0 comments on commit 7339d54

Please sign in to comment.