summaryrefslogtreecommitdiffstats
path: root/tests/get.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/get.rs')
-rw-r--r--tests/get.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/get.rs b/tests/get.rs
index 2df50a5..1922fca 100644
--- a/tests/get.rs
+++ b/tests/get.rs
@@ -88,6 +88,17 @@ fn test_get_scalar_path() {
}
#[test]
+fn test_get_scalar_path_subscript() {
+ let c = make();
+
+ assert_eq!(c.get("arr[2]").ok(), Some(3));
+ assert_eq!(c.get("items[0].name").ok(), Some("1".to_string()));
+ assert_eq!(c.get("items[1].name").ok(), Some("2".to_string()));
+ assert_eq!(c.get("items[-1].name").ok(), Some("2".to_string()));
+ assert_eq!(c.get("items[-2].name").ok(), Some("1".to_string()));
+}
+
+#[test]
fn test_map() {
let c = make();
let m: HashMap<String, Value> = c.get("place").unwrap();