Test serde_json interoperability

This commit is contained in:
Kornel 2018-08-06 15:23:32 +01:00
parent 985e21003f
commit 14338b8556

View file

@ -1,4 +1,5 @@
extern crate serde; extern crate serde;
extern crate serde_json;
extern crate toml; extern crate toml;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
@ -589,3 +590,15 @@ fn fixed_size_array() {
assert_eq!(value, expected); assert_eq!(value, expected);
assert_eq!(toml::to_string(&value).unwrap(), text); assert_eq!(toml::to_string(&value).unwrap(), text);
} }
#[test]
fn json_interoperability() {
#[derive(Serialize, Deserialize)]
struct Foo {
any: toml::Value
}
let _foo: Foo = serde_json::from_str(r#"
{"any":1}
"#).unwrap();
}