test: add test for shader preprocess
This commit is contained in:
parent
85497e47c1
commit
2128945c06
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -789,7 +789,9 @@ name = "librashader-preprocess"
|
|||
version = "0.1.0-beta.16"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"glob",
|
||||
"librashader-common",
|
||||
"librashader-presets",
|
||||
"nom",
|
||||
"rustc-hash",
|
||||
"thiserror",
|
||||
|
|
|
@ -21,3 +21,7 @@ encoding_rs = "0.8.31"
|
|||
[features]
|
||||
default = [ "line_directives" ]
|
||||
line_directives = []
|
||||
|
||||
[dev-dependencies]
|
||||
glob = "0.3.1"
|
||||
librashader-presets = { version = "0.1.0-beta.16", path = "../librashader-presets"}
|
19
librashader-preprocess/tests/parse_all.rs
Normal file
19
librashader-preprocess/tests/parse_all.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use glob::glob;
|
||||
use librashader_preprocess::{PreprocessError, ShaderSource};
|
||||
use librashader_presets::ShaderPreset;
|
||||
#[test]
|
||||
fn preprocess_all_slang_presets_parsed() {
|
||||
for entry in glob("../test/slang-shaders/**/*.slangp").unwrap() {
|
||||
if let Ok(path) = entry {
|
||||
if let Ok(preset) = ShaderPreset::try_parse(&path) {
|
||||
for shader in preset.shaders {
|
||||
ShaderSource::load(&shader.name).expect(&format!(
|
||||
"Failed to preprocess shader {} from preset {}",
|
||||
shader.name.display(),
|
||||
path.display()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue