@@ -40,6 +40,10 @@ class FormatTestTableGen : public ::testing::Test {
40
40
EXPECT_EQ (Code.str (), format (Code)) << " Expected code is not stable" ;
41
41
EXPECT_EQ (Code.str (), format (test::messUp (Code)));
42
42
}
43
+
44
+ static void verifyFormat (llvm::StringRef Result, llvm::StringRef MessedUp) {
45
+ EXPECT_EQ (Result, format (MessedUp));
46
+ }
43
47
};
44
48
45
49
TEST_F (FormatTestTableGen, FormatStringBreak) {
@@ -109,24 +113,26 @@ TEST_F(FormatTestTableGen, SimpleValue1_SingleLiterals) {
109
113
}
110
114
111
115
TEST_F (FormatTestTableGen, SimpleValue1_MultilineString) {
112
- // verifyFormat does not understand multiline TableGen code-literals
116
+ // test::messUp does not understand multiline TableGen code-literals.
117
+ // We have to give the result and the strings to format manually.
113
118
std::string DefWithCode =
114
119
" def SimpleValueCode {\n "
115
120
" let Code =\n "
116
121
" [{ A TokCode is nothing more than a multi-line string literal "
117
122
" delimited by \\ [{ and }\\ ]. It can break across lines and the line "
118
- " breaks are retained in the string. "
123
+ " breaks are retained in the string. \n "
119
124
" (https://llvm.org/docs/TableGen/ProgRef.html#grammar-token-TokCode)}];\n "
120
125
" }\n " ;
121
- std::string DefWithCodeMessingUp =
122
- " def SimpleValueCode {\n "
123
- " let Code= "
124
- " [{ A TokCode is nothing more than a multi-line string literal "
126
+ std::string DefWithCodeMessedUp =
127
+ " def SimpleValueCode { let \n "
128
+ " Code= \n "
129
+ " [{ A TokCode is nothing more than a multi-line string literal "
125
130
" delimited by \\ [{ and }\\ ]. It can break across lines and the line "
126
- " breaks are retained in the string. "
127
- " (https://llvm.org/docs/TableGen/ProgRef.html#grammar-token-TokCode)}];\n "
131
+ " breaks are retained in the string. \n "
132
+ " (https://llvm.org/docs/TableGen/ProgRef.html#grammar-token-TokCode)}] \n "
133
+ " ; \n "
128
134
" } \n " ;
129
- EXPECT_EQ (DefWithCode, format (DefWithCodeMessingUp) );
135
+ verifyFormat (DefWithCode, DefWithCodeMessedUp );
130
136
}
131
137
132
138
TEST_F (FormatTestTableGen, SimpleValue2) {
0 commit comments