fix(core): SymbolCharset needs content="value" for Custom(String)
Same latent bug as TrashRetention/HistoryRetention — serde's internally-tagged repr cannot merge a newtype primitive payload into a tag object. Add regression test for Custom round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,7 @@ pub struct CharClasses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
#[serde(tag = "kind", content = "value", rename_all = "snake_case")]
|
||||||
pub enum SymbolCharset {
|
pub enum SymbolCharset {
|
||||||
SafeOnly,
|
SafeOnly,
|
||||||
Extended,
|
Extended,
|
||||||
@@ -170,4 +170,15 @@ mod tests {
|
|||||||
_ => panic!("expected Random default"),
|
_ => panic!("expected Random default"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn symbol_charset_custom_round_trips() {
|
||||||
|
let c = SymbolCharset::Custom("!@#".into());
|
||||||
|
let json = serde_json::to_string(&c).unwrap();
|
||||||
|
let parsed: SymbolCharset = serde_json::from_str(&json).unwrap();
|
||||||
|
match parsed {
|
||||||
|
SymbolCharset::Custom(s) => assert_eq!(s, "!@#"),
|
||||||
|
other => panic!("expected Custom, got {:?}", other),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user