From 0253bcea5c2f345ff7fc6274233d108305fa8f2f Mon Sep 17 00:00:00 2001 From: "andries@fam-hiemstra.nl" Date: Tue, 17 Sep 2024 08:51:12 +0200 Subject: [PATCH] change to json test --- Cargo.toml | 1 + src/quickjs_utils/json.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c195c739749..f6c731898b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/quickjs_utils/json.rs b/src/quickjs_utils/json.rs index 680e18f0001..0e58f604780 100644 --- a/src/quickjs_utils/json.rs +++ b/src/quickjs_utils/json.rs @@ -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()); }); }