mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 10:04:08 +02:00
support tagged enums inside tables
This commit is contained in:
parent
988672437c
commit
21c048625e
5 changed files with 65 additions and 7 deletions
7
tests/data/enuminmap.vdf
Normal file
7
tests/data/enuminmap.vdf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
EnumInMap {
|
||||
foo {
|
||||
bar {
|
||||
a 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,16 @@ enum Expected {
|
|||
#[serde(rename = "$no_fullbright")]
|
||||
no_full_bright: bool,
|
||||
},
|
||||
EnumInMap {
|
||||
foo: EnumInMap,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum EnumInMap {
|
||||
Bar { a: bool },
|
||||
Foo { a: bool },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
|
|
@ -194,6 +204,7 @@ struct GameList {
|
|||
#[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")]
|
||||
#[test_case("tests/data/serde_array_type.vdf")]
|
||||
#[test_case("tests/data/game_text.vmt")]
|
||||
#[test_case("tests/data/enuminmap.vdf")]
|
||||
#[test_case("tests/errors/unmatched.vdf")]
|
||||
#[test_case("tests/errors/concrete.vmt")]
|
||||
#[test_case("tests/errors/novalue.vdf")]
|
||||
|
|
|
|||
9
tests/snapshots/serde__tests__data__enuminmap.vdf.snap
Normal file
9
tests/snapshots/serde__tests__data__enuminmap.vdf.snap
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
source: tests/serde.rs
|
||||
expression: result
|
||||
---
|
||||
EnumInMap(
|
||||
foo: bar(
|
||||
a: true,
|
||||
),
|
||||
)
|
||||
|
|
@ -4,11 +4,11 @@ expression: out
|
|||
---
|
||||
vmt_parser::unknown_variant
|
||||
|
||||
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite
|
||||
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap
|
||||
╭─[1:1]
|
||||
1 │ "Resource"
|
||||
· ─────┬────
|
||||
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite
|
||||
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap
|
||||
2 │ {
|
||||
╰────
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue