#![cfg(feature = "serde")] extern crate embedrs_bytes; extern crate serde_test; use serde_test::{Token, assert_tokens}; #[test] fn test_ser_de_empty() { let b = embedrs_bytes::Bytes::new(); assert_tokens(&b, &[Token::Bytes(b"")]); let b = embedrs_bytes::BytesMut::with_capacity(0); assert_tokens(&b, &[Token::Bytes(b"")]); } #[test] fn test_ser_de() { let b = embedrs_bytes::Bytes::from(&b"bytes"[..]); assert_tokens(&b, &[Token::Bytes(b"bytes")]); let b = embedrs_bytes::BytesMut::from(&b"bytes"[..]); assert_tokens(&b, &[Token::Bytes(b"bytes")]); }