Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrects Java's failure to match an end anchor when immediately prece…
…ded by a quantifier. Resolves #814
- Loading branch information
Faron Dutton
committed
Jun 8, 2023
1 parent
ac6ecd0
commit 0b68984
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/java/com/networknt/schema/regex/Issue814Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.networknt.schema.regex; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class Issue814Test { | ||
|
||
@Test | ||
void jdkTypePattern() { | ||
JDKRegularExpression ex = new JDKRegularExpression("^list|date|time|string|enum|int|double|long|boolean|number$"); | ||
assertTrue(ex.matches("list")); | ||
assertTrue(ex.matches("string")); | ||
assertTrue(ex.matches("boolean")); | ||
assertTrue(ex.matches("number")); | ||
assertTrue(ex.matches("enum")); | ||
} | ||
|
||
@Test | ||
void jdkOptionsPattern() { | ||
JDKRegularExpression ex = new JDKRegularExpression("^\\d*|[a-zA-Z_]+$"); | ||
assertTrue(ex.matches("external")); | ||
assertTrue(ex.matches("external_gte")); | ||
assertTrue(ex.matches("force")); | ||
assertTrue(ex.matches("internal")); | ||
} | ||
|
||
@Test | ||
void joniTypePattern() { | ||
JoniRegularExpression ex = new JoniRegularExpression("^list|date|time|string|enum|int|double|long|boolean|number$"); | ||
assertTrue(ex.matches("list")); | ||
assertTrue(ex.matches("string")); | ||
assertTrue(ex.matches("boolean")); | ||
assertTrue(ex.matches("number")); | ||
assertTrue(ex.matches("enum")); | ||
} | ||
|
||
@Test | ||
void joniOptionsPattern() { | ||
JoniRegularExpression ex = new JoniRegularExpression("^\\d*|[a-zA-Z_]+$"); | ||
assertTrue(ex.matches("internal")); | ||
assertTrue(ex.matches("external")); | ||
assertTrue(ex.matches("external_gte")); | ||
assertTrue(ex.matches("force")); | ||
} | ||
|
||
} |