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

@@ -136,9 +136,13 @@ public class JSONArray implements Iterable<Object> {
case ']':
if (strictMode) {
cursor = x.nextClean();
boolean isNotEoF = !x.end();
boolean isEoF = x.end();
if (isNotEoF && x.getArrayLevel() == 0) {
if (isEoF) {
break;
}
if (x.getArrayLevel() == 0) {
throw x.syntaxError(getInvalidCharErrorMsg(cursor));
}