This commit is contained in:
Robin Appelman 2023-12-15 15:51:53 +01:00
commit f492a63ab1
19 changed files with 1885 additions and 0 deletions

11
tests/data/concrete.vmt Normal file
View file

@ -0,0 +1,11 @@
"LightmappedGeneric"
{
"$baseTexture" "cp_mountainlab/concrete/concretefloor003"
"$bumpmap" "concrete/concretefloor007b_height-ssbump"
"$ssbump" "1"
"%keywords" "tf"
"$detail" "overlays/detail001"
"$detailscale" "1.9"
"$detailblendmode" "0"
"$detailblendfactor" "1"
}

12
tests/parse.rs Normal file
View file

@ -0,0 +1,12 @@
use std::fs::read_to_string;
use test_case::test_case;
use vdf_reader::entry::Table;
use vdf_reader::Reader;
#[test_case("tests/data/concrete.vmt")]
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");
insta::assert_ron_snapshot!(parsed);
}

View file

@ -0,0 +1,16 @@
---
source: tests/parse.rs
expression: parsed
---
Table({
"\"LightmappedGeneric\"": Table(Table({
"\"$detailblendfactor\"": Value(Value("\"1\"")),
"\"%keywords\"": Value(Value("\"tf\"")),
"\"$ssbump\"": Value(Value("\"1\"")),
"\"$baseTexture\"": Value(Value("\"cp_mountainlab/concrete/concretefloor003\"")),
"\"$detailblendmode\"": Value(Value("\"0\"")),
"\"$detailscale\"": Value(Value("\"1.9\"")),
"\"$bumpmap\"": Value(Value("\"concrete/concretefloor007b_height-ssbump\"")),
"\"$detail\"": Value(Value("\"overlays/detail001\"")),
})),
})