ast: ModuleCloneTest - check cloned program is valid

Helps catch brokenness before asking the developer to stare at AST dumps.

Change-Id: Id39602225ad2d4a1b72dcdf998b164feda870cf1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49751
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-05-05 10:23:11 +00:00 committed by Commit Bot service account
parent 58a3624935
commit 563cb58078
1 changed files with 2 additions and 0 deletions

View File

@ -120,6 +120,8 @@ let declaration_order_check_3 : i32 = 1;
// Clone the src program to dst
Program dst(src.Clone());
ASSERT_TRUE(dst.IsValid()) << diag::Formatter().format(dst.Diagnostics());
// Expect the AST printed with to_str() to match
EXPECT_EQ(src.to_str(), dst.to_str());