mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 12:21:35 +00:00
Switch all remaining AST stack allocations in tests to using create<T>() which will automatically inject the current Source as the first parameter. Most remaining uses of Source{} in the codebase are places where we need to fix. Bug: tint:396 Change-Id: I24655800b50d6ad52e682a7339022972e9b354d9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36380 Commit-Queue: Ben Clayton <bclayton@google.com> Commit-Queue: David Neto <dneto@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
// Copyright 2020 The Tint Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "gtest/gtest.h"
|
|
#include "src/ast/assignment_statement.h"
|
|
#include "src/ast/identifier_expression.h"
|
|
#include "src/ast/module.h"
|
|
#include "src/writer/msl/generator_impl.h"
|
|
#include "src/writer/msl/test_helper.h"
|
|
|
|
namespace tint {
|
|
namespace writer {
|
|
namespace msl {
|
|
namespace {
|
|
|
|
using MslGeneratorImplTest = TestHelper;
|
|
|
|
TEST_F(MslGeneratorImplTest, Emit_Assign) {
|
|
auto* assign = create<ast::AssignmentStatement>(Expr("lhs"), Expr("rhs"));
|
|
gen.increment_indent();
|
|
|
|
ASSERT_TRUE(gen.EmitStatement(assign)) << gen.error();
|
|
EXPECT_EQ(gen.result(), " lhs = rhs;\n");
|
|
}
|
|
|
|
} // namespace
|
|
} // namespace msl
|
|
} // namespace writer
|
|
} // namespace tint
|