more test

This commit is contained in:
Robin Appelman 2023-12-21 19:31:42 +01:00
commit bc68a8c3a1
3 changed files with 20 additions and 2 deletions

7
tests/data/game_text.vmt Normal file
View file

@ -0,0 +1,7 @@
"Sprite"
{
"$spriteorientation" "vp_parallel"
"$spriteorigin" "[ 0.50 0.50 ]"
"$basetexture" "editor/game_text"
"$no_fullbright" 1
}

View file

@ -54,6 +54,16 @@ enum Expected {
#[serde(rename = "Servers")] #[serde(rename = "Servers")]
servers: UserConfigDataServers, servers: UserConfigDataServers,
}, },
Sprite {
#[serde(rename = "$spriteorientation")]
sprite_orientation: String,
#[serde(rename = "$spriteorigin")]
sprite_origin: [f32; 2],
#[serde(rename = "$basetexture")]
base_texture: String,
#[serde(rename = "$no_fullbright")]
no_full_bright: bool,
},
} }
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
@ -173,6 +183,7 @@ struct GameList {
#[test_case("tests/data/messy.vdf")] #[test_case("tests/data/messy.vdf")]
#[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")] #[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")]
#[test_case("tests/data/serde_array_type.vdf")] #[test_case("tests/data/serde_array_type.vdf")]
#[test_case("tests/data/game_text.vmt")]
#[test_case("tests/errors/unmatched.vdf")] #[test_case("tests/errors/unmatched.vdf")]
#[test_case("tests/errors/concrete.vmt")] #[test_case("tests/errors/concrete.vmt")]
#[test_case("tests/errors/novalue.vdf")] #[test_case("tests/errors/novalue.vdf")]

View file

@ -4,11 +4,11 @@ expression: out
--- ---
vmt_parser::unknown_variant vmt_parser::unknown_variant
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData × Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite
╭─[1:1] ╭─[1:1]
1 │ "Resource" 1 │ "Resource"
· ─────┬──── · ─────┬────
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData · ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite
2 │ { 2 │ {
╰──── ╰────