cleanup: Refactor tests to use ast::Builder helpers

Change-Id: I5bf1dac217c9c6192c0637d98c4a38196d41cbe8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36382
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-01-05 15:44:39 +00:00
committed by Commit Bot service account
parent dbfe2de982
commit 1637cbb868
36 changed files with 170 additions and 468 deletions

View File

@@ -57,12 +57,11 @@ fn main() -> { # missing return type
TEST_F(ParserImplTest, GetRegisteredType) {
auto p = parser("");
ast::type::I32 i32;
p->register_constructed("my_alias", &i32);
p->register_constructed("my_alias", ty.i32);
auto* alias = p->get_constructed("my_alias");
ASSERT_NE(alias, nullptr);
ASSERT_EQ(alias, &i32);
ASSERT_EQ(alias, ty.i32);
}
TEST_F(ParserImplTest, GetUnregisteredType) {

View File

@@ -755,9 +755,8 @@ TEST_F(ParserImplTest, TypeDecl_Texture_Old) {
auto p = parser("texture_sampled_cube<f32>");
auto& mod = p->get_module();
ast::type::F32 f32;
auto* type = mod.create<ast::type::SampledTexture>(
ast::type::TextureDimension::kCube, &f32);
ast::type::TextureDimension::kCube, ty.f32);
auto t = p->type_decl();
EXPECT_TRUE(t.matched);
@@ -772,10 +771,9 @@ TEST_F(ParserImplTest, TypeDecl_Texture_Old) {
TEST_F(ParserImplTest, TypeDecl_Texture) {
auto p = parser("texture_cube<f32>");
ast::type::F32 f32;
auto& mod = p->get_module();
auto* type = mod.create<ast::type::SampledTexture>(
ast::type::TextureDimension::kCube, &f32);
ast::type::TextureDimension::kCube, ty.f32);
auto t = p->type_decl();
EXPECT_TRUE(t.matched);