diff --git a/naga/tests/validation.rs b/naga/tests/validation.rs index df8fad2ace..cd56355d1e 100644 --- a/naga/tests/validation.rs +++ b/naga/tests/validation.rs @@ -610,8 +610,9 @@ fn binding_arrays_cannot_hold_scalars() { #[cfg(feature = "wgsl-in")] #[test] fn validation_error_messages() { - let cases = [( - r#"@group(0) @binding(0) var my_sampler: sampler; + let cases = [ + ( + r#"@group(0) @binding(0) var my_sampler: sampler; fn foo(tex: texture_2d) -> vec4 { return textureSampleLevel(tex, my_sampler, vec2f(0, 0), 0.0); @@ -621,7 +622,7 @@ fn validation_error_messages() { foo(); } "#, - "\ + "\ error: Function [1] 'main' is invalid ┌─ wgsl:7:17 │ \n7 │ ╭ fn main() { @@ -632,7 +633,48 @@ error: Function [1] 'main' is invalid = Requires 1 arguments, but 0 are provided ", - )]; + ), + ( + "\ +@compute @workgroup_size(1, 1) +fn main() { + // Bad: `9001` isn't a `bool`. + _ = select(1, 2, 9001); +} +", + "\ +error: Entry point main at Compute is invalid + ┌─ wgsl:4:9 + │ +4 │ _ = select(1, 2, 9001); + │ ^^^^^^ naga::Expression [3] + │ + = Expression [3] is invalid + = Selecting is not possible + +", + ), + ( + "\ +@compute @workgroup_size(1, 1) +fn main() { + // Bad: `bool` and abstract int args. don't match. + _ = select(true, 1, false); +} +", + "\ +error: Entry point main at Compute is invalid + ┌─ wgsl:4:9 + │ +4 │ _ = select(true, 1, false); + │ ^^^^^^ naga::Expression [3] + │ + = Expression [3] is invalid + = Selecting is not possible + +", + ), + ]; for (source, expected_err) in cases { let module = naga::front::wgsl::parse_str(source).unwrap();