Skip to content

Commit

Permalink
googleJavaFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk committed Dec 17, 2024
1 parent 4786842 commit 8e608b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion java/com/google/re2j/Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ public int end(String group) {
return end(g);
}


/**
* Returns the program size of this pattern.
*
Expand Down
13 changes: 8 additions & 5 deletions javatests/com/google/re2j/ApiTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,15 @@ public static void testProgramSize(String pattern, int expectedSize) {
Matcher m2 = p.matcher(inputBytes);

Truth.assertWithMessage("Pattern(\"%s\") program size", p)
.that(p.programSize()).isEqualTo(expectedSize);
.that(p.programSize())
.isEqualTo(expectedSize);
Truth.assertWithMessage("Matcher(\"%s\", \"%s\") program size", m1.pattern(), input)
.that(m1.programSize()).isEqualTo(expectedSize);
Truth.assertWithMessage("Matcher(\"%s\", %s) program size", m2.pattern(),
Arrays.toString(inputBytes))
.that(m2.programSize()).isEqualTo(expectedSize);
.that(m1.programSize())
.isEqualTo(expectedSize);
Truth.assertWithMessage(
"Matcher(\"%s\", %s) program size", m2.pattern(), Arrays.toString(inputBytes))
.that(m2.programSize())
.isEqualTo(expectedSize);
}

public static void testGroup(String text, String regexp, String[] output) {
Expand Down
6 changes: 4 additions & 2 deletions javatests/com/google/re2j/MatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ public void testProgramSize() {
int programSize = pattern.programSize();
Truth.assertWithMessage("Pattern program size").that(programSize).isGreaterThan(1);
Truth.assertWithMessage("Positive matcher program size")
.that(pattern.matcher("good").programSize()).isEqualTo(programSize);
.that(pattern.matcher("good").programSize())
.isEqualTo(programSize);
Truth.assertWithMessage("Negative matcher program size")
.that(pattern.matcher("bad").programSize()).isEqualTo(programSize);
.that(pattern.matcher("bad").programSize())
.isEqualTo(programSize);
}

@Test
Expand Down

0 comments on commit 8e608b8

Please sign in to comment.