fix(#887): regressions, unit tests

- JSONArray now evaluates EOF accordingly for empty Array inputs.
- JSONTokener fixed indentation
- externalized two JSONMLTest cases
This commit is contained in:
rikkarth
2024-04-28 23:30:05 +01:00
parent cf00ef3e8a
commit 1ae43bdb90
8 changed files with 218 additions and 81 deletions

View File

@@ -47,14 +47,15 @@ public class JSONParserConfigurationTest {
}
@Test
public void givenEmptyArray_testStrictModeTrue_shouldNotThrowJsonException(){
public void givenEmptyArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
System.out.println(jsonArray);
assertEquals(testCase, jsonArray.toString());
}
@Test
@@ -215,7 +216,7 @@ public class JSONParserConfigurationTest {
() -> new JSONArray(testCaseFour, jsonParserConfiguration));
assertEquals(
"Field contains unbalanced quotes. Starts with \" but ends with single quote. at 6 [character 7 line 1]",
"Value 'test' is not surrounded by quotes at 13 [character 14 line 1]",
jeOne.getMessage());
assertEquals(
"Single quote wrap not allowed in strict mode at 2 [character 3 line 1]",