serde/test_suite/tests/unstable/mod.rs

26 lines
582 B
Rust
Raw Normal View History

2018-12-31 20:44:24 -06:00
use serde::{Deserialize, Serialize};
2018-08-22 20:06:23 -05:00
use serde_test::{assert_tokens, Token};
#[test]
fn test_raw_identifiers() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
enum r#type {
2018-09-02 01:03:41 -05:00
r#type { r#type: () },
2018-08-22 20:06:23 -05:00
}
assert_tokens(
&r#type::r#type { r#type: () },
&[
2018-09-02 01:03:41 -05:00
Token::StructVariant {
name: "type",
variant: "type",
len: 1,
},
2018-08-22 20:06:23 -05:00
Token::Str("type"),
Token::Unit,
Token::StructVariantEnd,
],
);
}