ntex/ntex-bytes/tests/test_serde.rs
msga-mmm 1b3a530fb7
fix(github-actions): use rust toolchain arm64 version for macos 14 (#355)
* fix(osx): use rust toolchain arm version for macos 14

* feat(ntex-bytes): remove conflicting serde feature flag
2024-05-05 10:16:13 +02:00

19 lines
531 B
Rust

#![deny(warnings, rust_2018_idioms)]
use serde_test::{assert_tokens, Token};
#[test]
fn test_ser_de_empty() {
let b = ntex_bytes::Bytes::new();
assert_tokens(&b, &[Token::Bytes(b"")]);
let b = ntex_bytes::BytesMut::with_capacity(0);
assert_tokens(&b, &[Token::Bytes(b"")]);
}
#[test]
fn test_ser_de() {
let b = ntex_bytes::Bytes::from(&b"bytes"[..]);
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
let b = ntex_bytes::BytesMut::from(&b"bytes"[..]);
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
}