mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 15:31:07 +00:00
Rewrite Value::lookup to not require an allocation
This commit is contained in:
@@ -1066,6 +1066,15 @@ fn test_missing_fmt_renamed_field() {
|
||||
assert_eq!(value, Foo { x: Some(5) });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_find_path() {
|
||||
let obj: Value = json::from_str(r#"{"x": {"a": 1}, "y": 2}"#).unwrap();
|
||||
|
||||
assert!(obj.find_path(&["x", "a"]).unwrap() == &Value::U64(1));
|
||||
assert!(obj.find_path(&["y"]).unwrap() == &Value::U64(2));
|
||||
assert!(obj.find_path(&["z"]).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lookup() {
|
||||
let obj: Value = json::from_str(r#"{"x": {"a": 1}, "y": 2}"#).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user