validation: add test for function params behave as const decl
Bug: tint:257 Change-Id: Ia5cdde240ecd2fa17dfeb08872037c18004fce06 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54821 Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
parent
567f2e4f3b
commit
c5cd6b9eb0
|
@ -331,6 +331,14 @@ TEST_F(ResolverFunctionValidationTest, FunctionConstInitWithParam) {
|
||||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ResolverFunctionValidationTest, FunctionParamsConst) {
|
||||||
|
Func("foo", {Param(Sym("arg"), ty.i32())}, ty.void_(),
|
||||||
|
{Assign(Expr(Source{{12, 34}}, "arg"), Expr(1)), Return()});
|
||||||
|
|
||||||
|
EXPECT_FALSE(r()->Resolve());
|
||||||
|
EXPECT_EQ(r()->error(), "12:34 error: cannot assign to value of type 'i32'");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
|
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
|
||||||
// [[stage(compute), workgroup_size(64.0)]
|
// [[stage(compute), workgroup_size(64.0)]
|
||||||
// fn main() {}
|
// fn main() {}
|
||||||
|
|
Loading…
Reference in New Issue