tests for string_empty_as_none added
@@ -598,6 +598,16 @@ fn tuple_list_as_map_vecdeque() {
);
}
+#[test]
+fn test_string_empty_as_none() {
+ #[derive(Debug, PartialEq, Deserialize, Serialize)]
+ struct S(#[serde(with = "serde_with::rust::string_empty_as_none", default)] Option<String>);
+
+ is_equal(S(Some("str".to_string())), expect![[r#""str""#]]);
+ check_deserialization(S(None), r#""""#);
+ check_deserialization(S(None), r#"null"#);
+}
+
#[test]
fn test_default_on_error() {
#[derive(Debug, PartialEq, Deserialize, Serialize)]
