Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkyPotato committed Jan 31, 2023
1 parent a073cea commit d07f6dd
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions tests/wgsl-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,13 +1624,56 @@ fn assign_to_let() {
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:4:10
┌─ wgsl:3:17
3 │ let a = 10;
│ ^ this is an immutable binding
4 │ a = 20;
│ ^ cannot assign to this expression
= note: 'a' is an immutable binding
= note: consider declaring it with `var` instead of `let`
= note: consider declaring 'a' with `var` instead of `let`
"###,
);

check(
"
fn f() {
let a = array(1, 2);
a[0] = 1;
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:3:17
3 │ let a = array(1, 2);
│ ^ this is an immutable binding
4 │ a[0] = 1;
│ ^^^^ cannot assign to this expression
= note: consider declaring 'a' with `var` instead of `let`
"###,
);

check(
"
struct S { a: i32 }
fn f() {
let a = S(10);
a.a = 20;
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:5:17
5 │ let a = S(10);
│ ^ this is an immutable binding
6 │ a.a = 20;
│ ^^^ cannot assign to this expression
= note: consider declaring 'a' with `var` instead of `let`
"###,
);
Expand Down

0 comments on commit d07f6dd

Please sign in to comment.