diff --git a/src/serde/se.rs b/src/serde/se.rs index e7987182..7ecb3297 100644 --- a/src/serde/se.rs +++ b/src/serde/se.rs @@ -193,7 +193,7 @@ where if self.first { Ok(()) } else { - iomap!(self.s.write(b"}")) + iomap!(self.s.write(b"]}")) } } } @@ -815,6 +815,20 @@ mod test { #[cfg(not(target_arch = "wasm32"))] use proptest::prelude::*; + #[test] + fn enum_tuple() { + #[derive(serde::Serialize, Clone)] + enum ErrType { + Instruction(i64, i64), + } + + let err = ErrType::Instruction(2, 68800); + + assert_eq!( + crate::to_string(&err).expect("failed to serialize"), + "{\"Instruction\":[2,68800]}", + ); + } #[test] fn print_serde() { #[derive(Clone, Debug, PartialEq, serde::Serialize)] diff --git a/src/tests/serde.rs b/src/tests/serde.rs index 8e3fa19b..998bf667 100644 --- a/src/tests/serde.rs +++ b/src/tests/serde.rs @@ -553,7 +553,6 @@ fn map1() { assert_eq!(to_value(d1), Ok(Value::from(h))); } -#[cfg(feature = "serde_impl")] #[test] fn tpl1() { let mut d = String::from("[-65.613616999999977, 43.420273000000009]"); @@ -701,7 +700,6 @@ fn crazy_string() { assert_eq!(v_simd, v_serde); } -#[cfg(feature = "serde_impl")] #[test] fn event() { #[derive(Deserialize, Debug, PartialEq, Eq)] @@ -825,7 +823,6 @@ fn arb_json() -> BoxedStrategy { .boxed() } -#[cfg(feature = "serde_impl")] #[test] fn int_map_key() -> Result<(), crate::Error> { use std::collections::BTreeMap;