Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f4201cf

Browse files
author
John J. Aylward
committed
Test cases for issue described in stleary#410.
1 parent 770cb9c commit f4201cf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/test/java/org/json/junit/JSONPointerTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ public void queryByEmptyKey() {
6262
assertSame(document.get(""), query("/"));
6363
}
6464

65+
@Test
66+
public void queryByEmptyKeySubObject() {
67+
assertSame(document.getJSONObject("obj").getJSONObject(""), query("/obj/"));
68+
}
69+
70+
@Test
71+
public void queryByEmptyKeySubObjectSubOject() {
72+
assertSame(
73+
document.getJSONObject("obj").getJSONObject("").get(""),
74+
query("/obj//")
75+
);
76+
}
77+
6578
@Test
6679
public void slashEscaping() {
6780
assertSame(document.get("a/b"), query("/a~1b"));

src/test/resources/jsonpointer-testdoc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"another/key" : [
2020
"val"
2121
]
22-
}
22+
},
23+
"" : { "" : "empty key of an object with an empty key" }
2324
}
2425
}

0 commit comments

Comments
 (0)