add support for deserializing a map with int keys as a sequence

This commit is contained in:
Robin Appelman 2025-06-05 20:42:13 +02:00
commit b928f85df6
14 changed files with 226 additions and 9 deletions

View file

@ -69,6 +69,7 @@ enum Expected {
EnumInMap {
foo: EnumInMap,
},
MapArray(Vec<String>),
}
#[derive(Debug, Serialize, Deserialize)]
@ -211,6 +212,8 @@ struct GameList {
#[test_case("tests/errors/concrete.vmt")]
#[test_case("tests/errors/novalue.vdf")]
#[test_case("tests/errors/serde_array_type.vdf")]
#[test_case("tests/data/maparray.vdf")]
#[test_case("tests/errors/invalidmaparraykeys.vdf")]
fn test_serde(path: &str) {
let raw = read_to_string(path).unwrap();
match from_str::<Expected>(&raw) {
@ -228,6 +231,7 @@ fn test_serde(path: &str) {
#[test_case("tests/data/concrete.vmt")]
#[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")]
#[test_case("tests/data/serde_array_type.vdf")]
#[test_case("tests/data/maparray.vdf")]
fn test_serde_table(path: &str) {
let raw = read_to_string(path).unwrap();
match from_str::<Table>(&raw) {
@ -247,6 +251,7 @@ fn test_serde_table(path: &str) {
#[test_case("tests/data/messy.vdf")]
#[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")]
#[test_case("tests/data/serde_array_type.vdf")]
#[test_case("tests/data/maparray.vdf")]
fn test_serde_from_table(path: &str) {
let raw = read_to_string(path).unwrap();
let result = Table::load_from_str(&raw).unwrap();