test for broken array

This commit is contained in:
Robin Appelman 2023-12-15 20:06:52 +01:00
commit ff98651b2a
3 changed files with 6 additions and 1 deletions

View file

@ -11,4 +11,5 @@
windows_path "C:\test\no newline"
\\"$translucent" 1 // this is read vdf written by real valve developers
"$envmaptint" .5 .5 .5 // found in the wild, pretty sure they mean "[.5 .5 .5]", but it ends up working by accident with a stray `.5 = .5` kv
}

View file

@ -9,6 +9,8 @@ use vdf_reader::Reader;
fn test_parse(path: &str) {
let raw = read_to_string(path).unwrap();
let mut reader = Reader::from(raw.as_str());
let parsed = Table::load(&mut reader).expect("failed to parse test data");
let parsed = Table::load(&mut reader)
.map_err(miette::Error::from)
.expect("failed to parse test data");
insta::assert_ron_snapshot!(path, parsed);
}

View file

@ -5,6 +5,8 @@ expression: parsed
Table({
"#base": Statement(Statement("panelBase.res")),
"Resource/specificPanel.res": Table(Table({
"$envmaptint": Value(Value(".5")),
".5": Value(Value(".5")),
"\\\"$translucent\"": Value(Value("1")),
"array": Array(Array([
Value(Value("1")),