mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-03 11:44:09 +00:00
21 lines
528 B
Rust
21 lines
528 B
Rust
|
#![cfg(feature = "serde")]
|
||
|
#![warn(rust_2018_idioms)]
|
||
|
|
||
|
use serde_test::{assert_tokens, Token};
|
||
|
|
||
|
#[test]
|
||
|
fn test_ser_de_empty() {
|
||
|
let b = bytes::Bytes::new();
|
||
|
assert_tokens(&b, &[Token::Bytes(b"")]);
|
||
|
let b = bytes::BytesMut::with_capacity(0);
|
||
|
assert_tokens(&b, &[Token::Bytes(b"")]);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn test_ser_de() {
|
||
|
let b = bytes::Bytes::from(&b"bytes"[..]);
|
||
|
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
|
||
|
let b = bytes::BytesMut::from(&b"bytes"[..]);
|
||
|
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
|
||
|
}
|