diff --git a/crates/toml/tests/testsuite/serde.rs b/crates/toml/tests/testsuite/serde.rs index 82ba00b1..ae762b3d 100644 --- a/crates/toml/tests/testsuite/serde.rs +++ b/crates/toml/tests/testsuite/serde.rs @@ -742,6 +742,26 @@ fn newtype_variant() { } } +#[test] +#[should_panic = "invalid type: string \"x\", expected tuple struct NewType"] +fn newtype_key() { + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Serialize, Deserialize)] + struct NewType(String); + + type CustomKeyMap = std::collections::BTreeMap; + + equivalent! { + [ + (NewType("x".to_owned()), 1), + (NewType("y".to_owned()), 2), + ].into_iter().collect::(), + map! { + x: Value::Integer(1), + y: Value::Integer(2) + }, + } +} + #[derive(Debug, Default, PartialEq, Serialize, Deserialize)] struct CanBeEmpty { a: Option,