mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-10 12:34:30 +08:00
fix(#887): complete strictMode for JSONArray
This commit is contained in:
@@ -46,6 +46,16 @@ public class JSONParserConfigurationTest {
|
||||
() -> new JSONArray(testCase, jsonParserConfiguration)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenValidDoubleArray_testStrictModeTrue_shouldNotThrowJsonException() {
|
||||
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
|
||||
.withStrictMode(true);
|
||||
|
||||
String testCase = "[[\"c\"],[\"a\"]]";
|
||||
|
||||
new JSONArray(testCase, jsonParserConfiguration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCompliantJSONArrayFile_testStrictModeTrue_shouldNotThrowAnyException() throws IOException {
|
||||
try (Stream<String> lines = Files.lines(Paths.get("src/test/resources/compliantJsonArray.json"))) {
|
||||
@@ -208,6 +218,15 @@ public class JSONParserConfigurationTest {
|
||||
*/
|
||||
private List<String> getNonCompliantJSONList() {
|
||||
return Arrays.asList(
|
||||
"[]asdf",
|
||||
"[]]",
|
||||
"[]}",
|
||||
"[][",
|
||||
"[]{",
|
||||
"[],",
|
||||
"[]:",
|
||||
"[],[",
|
||||
"[],{",
|
||||
"[1,2];[3,4]",
|
||||
"[test]",
|
||||
"[{'testSingleQuote': 'testSingleQuote'}]",
|
||||
|
Reference in New Issue
Block a user