Skip to content

Commit df5a8f6

Browse files
SYNC POINT: merge
3 parents 4c8503b + d2dbbbb + 15bf5be commit df5a8f6

3 files changed

Lines changed: 153 additions & 137 deletions

File tree

Cargo.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ members = [
2727
]
2828
exclude = []
2929
default-members = [
30-
"benches",
31-
"examples/features",
32-
"examples/standalone/*",
33-
"lock-analyzer",
34-
"naga-cli",
30+
# "benches",
31+
# "examples/features",
32+
# "examples/standalone/*",
33+
# "lock-analyzer",
34+
# "naga-cli",
3535
"naga",
36-
"naga/fuzz",
37-
"naga/hlsl-snapshots",
38-
"naga/xtask",
39-
"player",
40-
"tests",
41-
"wgpu-core",
42-
"wgpu-core/platform-deps/*",
43-
"wgpu-hal",
44-
"wgpu-info",
45-
"wgpu-macros",
46-
"wgpu-types",
47-
"wgpu",
48-
"xtask",
36+
# "naga/fuzz",
37+
# "naga/hlsl-snapshots",
38+
# "naga/xtask",
39+
# "player",
40+
# "tests",
41+
# "wgpu-core",
42+
# "wgpu-core/platform-deps/*",
43+
# "wgpu-hal",
44+
# "wgpu-info",
45+
# "wgpu-macros",
46+
# "wgpu-types",
47+
# "wgpu",
48+
# "xtask",
4949
]
5050

5151
[workspace.lints.clippy]

naga/tests/naga/validation.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,27 @@ fn binding_arrays_cannot_hold_scalars() {
645645
assert!(t.validator.validate(&t.module).is_err());
646646
}
647647

648+
#[cfg(feature = "wgsl-in")]
649+
#[track_caller]
650+
fn assert_wgsl_validation_err(input: &str, snapshot: &str) {
651+
let module = naga::front::wgsl::parse_str(input)
652+
.expect("expected parsed WGSL module, but WGSL parse failed");
653+
let err = valid::Validator::new(Default::default(), valid::Capabilities::all())
654+
.validate(&module)
655+
.expect_err("module should be invalid");
656+
let output = err.emit_to_string(input);
657+
if output != snapshot {
658+
for diff in diff::lines(snapshot, &output) {
659+
match diff {
660+
diff::Result::Left(l) => println!("-{l}"),
661+
diff::Result::Both(l, _) => println!(" {l}"),
662+
diff::Result::Right(r) => println!("+{r}"),
663+
}
664+
}
665+
panic!("Error snapshot failed");
666+
}
667+
}
668+
648669
#[cfg(feature = "wgsl-in")]
649670
#[test]
650671
fn validation_error_messages() {
@@ -673,12 +694,7 @@ error: Function [1] 'main' is invalid
673694
)];
674695

675696
for (source, expected_err) in cases {
676-
let module = naga::front::wgsl::parse_str(source).unwrap();
677-
let err = valid::Validator::new(Default::default(), valid::Capabilities::all())
678-
.validate(&module)
679-
.expect_err("module should be invalid");
680-
println!("{}", err.emit_to_string(source));
681-
assert_eq!(err.emit_to_string(source), expected_err);
697+
assert_wgsl_validation_err(source, expected_err)
682698
}
683699
}
684700

0 commit comments

Comments
 (0)