diff options
author | Vincent Prouillet <vincent@wearewizards.io> | 2017-04-24 21:48:02 +0900 |
---|---|---|
committer | Vincent Prouillet <vincent@wearewizards.io> | 2017-04-24 22:13:38 +0900 |
commit | 099d7b66836bc994b26e78b4066f28f32b82ffe9 (patch) | |
tree | ac91ac55ae3f119165c1b4425754e5de76c763fa /tests | |
parent | 9942435bbcd6a41bf39bd298e93b7b57aaa87b6d (diff) | |
download | milf-rs-099d7b66836bc994b26e78b4066f28f32b82ffe9.tar.gz milf-rs-099d7b66836bc994b26e78b4066f28f32b82ffe9.zip |
Allow to deserialize/serialize into enums
Close #164
Diffstat (limited to 'tests')
-rw-r--r-- | tests/serde.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/serde.rs b/tests/serde.rs index bfbdc6f..0f4c37a 100644 --- a/tests/serde.rs +++ b/tests/serde.rs @@ -329,6 +329,25 @@ fn parse_enum() { } } +#[test] +fn parse_enum_string() { + #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] + struct Foo { a: Sort } + + #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] + #[serde(rename_all = "lowercase")] + enum Sort { + Asc, + Desc, + } + + equivalent! { + Foo { a: Sort::Desc }, + Table(map! { a: Value::String("desc".to_string()) }), + } + +} + // #[test] // fn unused_fields() { // #[derive(Serialize, Deserialize, PartialEq, Debug)] |