feat(#871-strictMode): add allowSingleQuote option, add enhancements and simplification

This commit is contained in:
rikkarth
2024-03-30 11:06:30 +00:00
parent d2cb38dba7
commit c0918c2428
5 changed files with 58 additions and 30 deletions

View File

@@ -118,9 +118,9 @@ public class JSONParserConfigurationTest {
}
@Test
public void givenUnbalancedQuotes_testStrictModeTrue_shouldThrowJsonExceptionWtihConcreteErrorDescription() {
public void givenUnbalancedQuotes_testStrictModeTrueAndAllowSingleQuotes_shouldThrowJsonExceptionWtihConcreteErrorDescription() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
.withStrictMode(true).allowSingleQuotes(true);
String testCaseOne = "[\"abc', \"test\"]";
String testCaseTwo = "['abc\", \"test\"]";
@@ -198,6 +198,7 @@ public class JSONParserConfigurationTest {
return Arrays.asList(
"[1,2];[3,4]",
"[test]",
"[{'testSingleQuote': 'testSingleQuote'}]",
"[1, 2,3]:[4,5]",
"[{test: implied}]",
"[{\"test\": implied}]",