diff --git a/Cargo.toml b/Cargo.toml index e7c4d998..4079d85c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ getrandom = { version = "0.2", optional = true } rustyline = { version = "10", optional = true } [dev-dependencies] -serde_bytes = "0.11" rmp-serde = "1.1" serde_json = { version = "1.0", default-features = false, features = ["alloc"] } diff --git a/tests/serde.rs b/tests/serde.rs index 2787ca2f..88483ec4 100644 --- a/tests/serde.rs +++ b/tests/serde.rs @@ -798,6 +798,7 @@ fn test_serde_optional() -> Result<(), Box> { #[test] #[cfg(not(feature = "no_index"))] +#[cfg(not(feature = "no_object"))] fn test_serde_blob() -> Result<(), Box> { let engine = Engine::new(); @@ -805,35 +806,17 @@ fn test_serde_blob() -> Result<(), Box> { " let x = blob(10); for i in 0..10 { x[i] = i; } - x + #{ x: x } ", )?; - let json = serde_json::to_string(&r).unwrap(); + let data = format!("{r:?}"); - assert_eq!(json, "[0,1,2,3,4,5,6,7,8,9]"); + let encoded = rmp_serde::to_vec(&r).unwrap(); + let decoded: Dynamic = rmp_serde::from_slice(&encoded).unwrap(); - let r = from_dynamic::(&r)?; + assert_eq!(format!("{decoded:?}"), data); - assert_eq!(r.to_vec(), vec![0_u8, 1, 2, 3, 4, 5, 6, 7, 8, 9]); - - #[cfg(not(feature = "no_object"))] - { - let r = engine.eval::( - " - let x = blob(10); - for i in 0..10 { x[i] = i; } - #{ x: x } - ", - )?; - - let data = format!("{r:?}"); - - let encoded = rmp_serde::to_vec(&r).unwrap(); - let decoded: Dynamic = rmp_serde::from_slice(&encoded).unwrap(); - - assert_eq!(format!("{decoded:?}"), data); - } Ok(()) }