Skip to content

Commit 307f4e7

Browse files
WIP
1 parent 2b719f5 commit 307f4e7

2 files changed

Lines changed: 41 additions & 20 deletions

File tree

naga/tests/naga/validation.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -691,26 +691,6 @@ error: Function [1] 'main' is invalid
691691
\n = Call to [0] is invalid
692692
= Requires 1 arguments, but 0 are provided
693693
694-
",
695-
),
696-
(
697-
"\
698-
@compute @workgroup_size(1, 1)
699-
fn main() {
700-
// Bad: `9001` isn't a `bool`.
701-
_ = select(1, 2, 9001);
702-
}
703-
",
704-
"\
705-
error: Entry point main at Compute is invalid
706-
┌─ wgsl:4:9
707-
708-
4 │ _ = select(1, 2, 9001);
709-
│ ^^^^^^ naga::ir::Expression [3]
710-
711-
= Expression [3] is invalid
712-
= Expected selection condition to be a boolean value, got Scalar(Scalar { kind: Sint, width: 4 })
713-
714694
",
715695
),
716696
(

naga/tests/naga/wgsl_errors.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,47 @@ fn select() {
20812081
)
20822082
if name.starts_with("select_")
20832083
}
2084+
2085+
let snapshots = [
2086+
(
2087+
"\
2088+
@compute @workgroup_size(1, 1)
2089+
fn main() {
2090+
// Bad: `9001` isn't a `bool`.
2091+
_ = select(1, 2, 9001);
2092+
}
2093+
",
2094+
"\
2095+
error: Expected boolean expression for condition argument of `select`, got something else
2096+
┌─ wgsl:4:9
2097+
2098+
4 │ _ = select(1, 2, 9001);
2099+
│ ^^^^^^ see msg
2100+
2101+
",
2102+
),
2103+
(
2104+
"\
2105+
@compute @workgroup_size(1, 1)
2106+
fn main() {
2107+
// Bad: `bool` and abstract int args. don't match.
2108+
_ = select(true, 1, false);
2109+
}
2110+
",
2111+
"\
2112+
error: Expected boolean expression for condition argument of `select`, got something else
2113+
┌─ wgsl:4:9
2114+
2115+
4 │ _ = select(true, 1, false);
2116+
│ ^^^^^^ see msg
2117+
2118+
",
2119+
),
2120+
];
2121+
2122+
for (input, snapshot) in snapshots {
2123+
assert_parse_err(input, snapshot);
2124+
}
20842125
}
20852126

20862127
#[test]

0 commit comments

Comments
 (0)