Array append fails when its in an object #1

Closed
opened 4 years ago by Ghost · 1 comments
Ghost commented 4 years ago

Test:

let mut test_inner_array = Value::Null;
test_inner_array.dot_set("name", Value::String(String::from("Google")));
test_inner_array.dot_set("todos.+", Value::String(String::from("Go to Class")));
test_inner_array.dot_set("todos.+", Value::String(String::from("Fish")));
assert_eq!(json!({"name" : "Google", "todos" : ["Go to class","Fish"] }), test_inner_array);

Error:

Expected :Object({"name": String("Google"), "todos": Array([String("Go to Class")])})
Actual   :Object({"name": String("Google"), "todos": Array([String("Go to class"), String("Fish")])})
Test: ```rust let mut test_inner_array = Value::Null; test_inner_array.dot_set("name", Value::String(String::from("Google"))); test_inner_array.dot_set("todos.+", Value::String(String::from("Go to Class"))); test_inner_array.dot_set("todos.+", Value::String(String::from("Fish"))); assert_eq!(json!({"name" : "Google", "todos" : ["Go to class","Fish"] }), test_inner_array); ``` Error: ```bash Expected :Object({"name": String("Google"), "todos": Array([String("Go to Class")])}) Actual :Object({"name": String("Google"), "todos": Array([String("Go to class"), String("Fish")])}) ```
Owner

fixed in 1.0.2, thanks for report

fixed in 1.0.2, thanks for report
MightyPork closed this issue 4 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: packages/json_dotpath#1
Loading…
There is no content yet.