Remove serde_bytes.

This commit is contained in:
Stephen Chung 2022-11-22 15:52:31 +08:00
parent b2e4efd872
commit 94aeab1015
2 changed files with 6 additions and 24 deletions

View File

@ -37,7 +37,6 @@ getrandom = { version = "0.2", optional = true }
rustyline = { version = "10", optional = true } rustyline = { version = "10", optional = true }
[dev-dependencies] [dev-dependencies]
serde_bytes = "0.11"
rmp-serde = "1.1" rmp-serde = "1.1"
serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde_json = { version = "1.0", default-features = false, features = ["alloc"] }

View File

@ -798,6 +798,7 @@ fn test_serde_optional() -> Result<(), Box<EvalAltResult>> {
#[test] #[test]
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[cfg(not(feature = "no_object"))]
fn test_serde_blob() -> Result<(), Box<EvalAltResult>> { fn test_serde_blob() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new(); let engine = Engine::new();
@ -805,35 +806,17 @@ fn test_serde_blob() -> Result<(), Box<EvalAltResult>> {
" "
let x = blob(10); let x = blob(10);
for i in 0..10 { x[i] = i; } 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::<serde_bytes::ByteBuf>(&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::<Dynamic>(
"
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(()) Ok(())
} }