[validation] Add disabled test for v-0024-entry point functions return void

Bug: tint: 6
Change-Id: Iae865125b30952a9422261fbfe14e9b6fb74e16f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27101
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Sarah Mashayekhi 2020-08-20 21:51:39 +00:00 committed by Commit Bot service account
parent 3c9fee13b9
commit 1026fe3d27
1 changed files with 26 additions and 0 deletions

View File

@ -285,5 +285,31 @@ TEST_F(ValidateFunctionTest, EntryPointFunctionExist_Pass) {
tint::ValidatorImpl v; tint::ValidatorImpl v;
EXPECT_TRUE(v.Validate(mod())) << v.error(); EXPECT_TRUE(v.Validate(mod())) << v.error();
} }
TEST_F(ValidateFunctionTest, DISABLED_EntryPointFunctionNotVoid_Fail) {
// entry_point vertex as "main" = vtx_main
// fn vtx_main() -> i32 { return 0; }
ast::type::I32Type i32;
ast::VariableList params;
auto func =
std::make_unique<ast::Function>("vtx_main", std::move(params), &i32);
auto return_expr = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::SintLiteral>(&i32, 0));
auto body = std::make_unique<ast::BlockStatement>();
body->append(std::make_unique<ast::ReturnStatement>(std::move(return_expr)));
func->set_body(std::move(body));
auto entry_point = std::make_unique<ast::EntryPoint>(
ast::PipelineStage::kVertex, "main", "vtx_main");
mod()->AddFunction(std::move(func));
mod()->AddEntryPoint(std::move(entry_point));
EXPECT_TRUE(td()->Determine()) << td()->error();
tint::ValidatorImpl v;
EXPECT_FALSE(v.Validate(mod()));
EXPECT_EQ(v.error(),
"12:34: v-0024: Entry point function must return void: 'vtx_main'");
}
} // namespace } // namespace
} // namespace tint } // namespace tint