Extend entry point to str testing
This CL adds more tests for the entry point to str method. Bug: tint:11 Change-Id: I54bb349d606d05221d649215b7b2c6477cca6819 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16480 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
18747b657a
commit
89b2aa1207
|
@ -42,8 +42,11 @@ bool EntryPoint::IsValid() const {
|
|||
|
||||
void EntryPoint::to_str(std::ostream& out, size_t indent) const {
|
||||
make_indent(out, indent);
|
||||
out << R"(EntryPoint{")" << stage_ << R"(" as ")" << name_ << R"(" = )"
|
||||
<< fn_name_ << "}" << std::endl;
|
||||
out << "EntryPoint{" << stage_;
|
||||
if (name_.length() > 0)
|
||||
out << " as " << name_;
|
||||
|
||||
out << " = " << fn_name_ << "}" << std::endl;
|
||||
}
|
||||
|
||||
} // namespace ast
|
||||
|
|
|
@ -59,16 +59,8 @@ TEST_F(EntryPointTest, CreationEmpty) {
|
|||
EXPECT_EQ(e.column(), 4);
|
||||
}
|
||||
|
||||
TEST_F(EntryPointTest, to_str) {
|
||||
EntryPoint e(PipelineStage::kVertex, "text", "vtx_main");
|
||||
std::ostringstream out;
|
||||
e.to_str(out, 0);
|
||||
EXPECT_EQ(out.str(), R"(EntryPoint{"vertex" as "text" = vtx_main}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(EntryPointTest, IsValid) {
|
||||
EntryPoint e(PipelineStage::kVertex, "main", "vtx_main");
|
||||
EntryPoint e(PipelineStage::kVertex, "", "vtx_main");
|
||||
EXPECT_TRUE(e.IsValid());
|
||||
}
|
||||
|
||||
|
@ -87,5 +79,21 @@ TEST_F(EntryPointTest, IsValid_MissingBoth) {
|
|||
EXPECT_FALSE(e.IsValid());
|
||||
}
|
||||
|
||||
TEST_F(EntryPointTest, ToStr) {
|
||||
EntryPoint e(PipelineStage::kVertex, "text", "vtx_main");
|
||||
std::ostringstream out;
|
||||
e.to_str(out, 2);
|
||||
EXPECT_EQ(out.str(), R"( EntryPoint{vertex as text = vtx_main}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(EntryPointTest, ToStr_NoName) {
|
||||
EntryPoint e(PipelineStage::kVertex, "", "vtx_main");
|
||||
std::ostringstream out;
|
||||
e.to_str(out, 2);
|
||||
EXPECT_EQ(out.str(), R"( EntryPoint{vertex = vtx_main}
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
|
Loading…
Reference in New Issue