better errors for unmatched variants

This commit is contained in:
Robin Appelman 2023-12-18 17:08:00 +01:00
commit 23bc240d4f
5 changed files with 84 additions and 8 deletions

View file

@ -0,0 +1,4 @@
"Resource"
{
foo
}

View file

@ -158,6 +158,7 @@ struct GameList {
#[test_case("tests/data/messy.vdf")]
#[test_case("tests/data/DialogConfigOverlay_1280x720.vdf")]
#[test_case("tests/data/serde_array_type.vdf")]
#[test_case("tests/errors/unmatched.vdf")]
#[test_case("tests/errors/concrete.vmt")]
#[test_case("tests/errors/novalue.vdf")]
#[test_case("tests/errors/serde_array_type.vdf")]

View file

@ -0,0 +1,14 @@
---
source: tests/serde.rs
expression: out
---
vmt_parser::unknown_variant
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData
╭─[1:1]
1 │ "Resource"
· ─────┬────
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData
2 │ {
╰────