@@ -20,24 +20,19 @@ using namespace llvm;
2020using Definition = FormatEntity::Entry::Definition;
2121using Entry = FormatEntity::Entry;
2222
23- namespace {
24- class FormatEntityTest : public ::testing::Test {
25- public:
26- Expected<std::string> Format (StringRef format_str) {
27- StreamString stream;
28- FormatEntity::Entry format;
29- Status status = FormatEntity::Parse (format_str, format);
30- if (status.Fail ())
31- return status.ToError ();
32-
33- FormatEntity::Format (format, stream, nullptr , nullptr , nullptr , nullptr ,
34- false , false );
35- return stream.GetString ().str ();
36- }
37- };
38- } // namespace
23+ static Expected<std::string> Format (StringRef format_str) {
24+ StreamString stream;
25+ FormatEntity::Entry format;
26+ Status status = FormatEntity::Parse (format_str, format);
27+ if (status.Fail ())
28+ return status.ToError ();
29+
30+ FormatEntity::Format (format, stream, nullptr , nullptr , nullptr , nullptr ,
31+ false , false );
32+ return stream.GetString ().str ();
33+ }
3934
40- TEST_F (FormatEntityTest, DefinitionConstructionNameAndType) {
35+ TEST (FormatEntityTest, DefinitionConstructionNameAndType) {
4136 Definition d (" foo" , FormatEntity::Entry::Type::Invalid);
4237
4338 EXPECT_STREQ (d.name , " foo" );
@@ -49,7 +44,7 @@ TEST_F(FormatEntityTest, DefinitionConstructionNameAndType) {
4944 EXPECT_FALSE (d.keep_separator );
5045}
5146
52- TEST_F (FormatEntityTest, DefinitionConstructionNameAndString) {
47+ TEST (FormatEntityTest, DefinitionConstructionNameAndString) {
5348 Definition d (" foo" , " string" );
5449
5550 EXPECT_STREQ (d.name , " foo" );
@@ -61,7 +56,7 @@ TEST_F(FormatEntityTest, DefinitionConstructionNameAndString) {
6156 EXPECT_FALSE (d.keep_separator );
6257}
6358
64- TEST_F (FormatEntityTest, DefinitionConstructionNameTypeData) {
59+ TEST (FormatEntityTest, DefinitionConstructionNameTypeData) {
6560 Definition d (" foo" , FormatEntity::Entry::Type::Invalid, 33 );
6661
6762 EXPECT_STREQ (d.name , " foo" );
@@ -73,7 +68,7 @@ TEST_F(FormatEntityTest, DefinitionConstructionNameTypeData) {
7368 EXPECT_FALSE (d.keep_separator );
7469}
7570
76- TEST_F (FormatEntityTest, DefinitionConstructionNameTypeChildren) {
71+ TEST (FormatEntityTest, DefinitionConstructionNameTypeChildren) {
7772 Definition d (" foo" , FormatEntity::Entry::Type::Invalid, 33 );
7873 Definition parent (" parent" , FormatEntity::Entry::Type::Invalid, 1 , &d);
7974 EXPECT_STREQ (parent.name , " parent" );
@@ -173,15 +168,15 @@ constexpr llvm::StringRef lookupStrings[] = {
173168 " ${target.file.fullpath}" ,
174169 " ${var.dummy-var-to-test-wildcard}" };
175170
176- TEST_F (FormatEntityTest, LookupAllEntriesInTree) {
171+ TEST (FormatEntityTest, LookupAllEntriesInTree) {
177172 for (const llvm::StringRef testString : lookupStrings) {
178173 Entry e;
179174 EXPECT_TRUE (FormatEntity::Parse (testString, e).Success ())
180175 << " Formatting " << testString << " did not succeed" ;
181176 }
182177}
183178
184- TEST_F (FormatEntityTest, Scope) {
179+ TEST (FormatEntityTest, Scope) {
185180 // Scope with one alternative.
186181 EXPECT_THAT_EXPECTED (Format (" {${frame.pc}|foo}" ), HasValue (" foo" ));
187182
0 commit comments