mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 10:04:08 +02:00
init
This commit is contained in:
commit
f492a63ab1
19 changed files with 1885 additions and 0 deletions
11
tests/data/concrete.vmt
Normal file
11
tests/data/concrete.vmt
Normal 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
12
tests/parse.rs
Normal 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);
|
||||
}
|
||||
16
tests/snapshots/parse__parse.snap
Normal file
16
tests/snapshots/parse__parse.snap
Normal 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\"")),
|
||||
})),
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue