Skip to content

Commit

Permalink
change to json test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrieshiemstra committed Sep 17, 2024
1 parent bc3e747 commit 0253bce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ tracing-log = "0.1"
tracing-gelf = "0.7"
simple-logging = "2.0.2"
tokio = {version = "1", features=["macros"]}
anyhow="1"

[dev-dependencies.cargo-husky]
version = "1.5.0"
Expand Down
6 changes: 3 additions & 3 deletions src/quickjs_utils/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ pub mod tests {
.unwrap();
let str_res = json::stringify_q(q_ctx, &obj, None).ok().unwrap();
assert_eq!(str_res.get_ref_count(), 1);
let json = str_res.to_str().ok().unwrap();
let json = str_res.to_string().ok().unwrap();
assert_eq!(json, "{\"a\":532,\"b\":true,\"c\":\"abcdË\"}");

let obj2 = json::parse_q(q_ctx, json).ok().unwrap();
let obj2 = parse_q(q_ctx, json.as_str()).ok().unwrap();

let prop_c = objects::get_property_q(q_ctx, &obj2, "c").ok().unwrap();
assert_eq!("abcdË", prop_c.to_str().ok().unwrap());
assert_eq!("abcdË", prop_c.to_string().ok().unwrap());
});
}

Expand Down

0 comments on commit 0253bce

Please sign in to comment.