Skip to content

Commit 2cb9b47

Browse files
committed
add test for #173
1 parent 9d0a363 commit 2cb9b47

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

json-path/src/test/java/com/jayway/jsonpath/PathCompilerTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,19 @@ public void issue_predicate_can_have_square_bracket_in_prop() {
251251

252252
assertThat(result).containsExactly("] it");
253253
}
254+
255+
@Test(expected = InvalidPathException.class)
256+
public void array_indexes_must_be_separated_by_commas() {
257+
compile("$[0, 1, 2 4]");
258+
}
259+
260+
@Test(expected = InvalidPathException.class)
261+
public void trailing_comma_after_list_is_not_accepted() {
262+
compile("$['1','2',]");
263+
}
264+
265+
@Test(expected = InvalidPathException.class)
266+
public void accept_only_a_single_comma_between_indexes() {
267+
compile("$['1', ,'3']");
268+
}
254269
}

0 commit comments

Comments
 (0)