forked from OSchip/llvm-project
clang-format: [JS] respect clang-format off when requoting strings.
Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20200 llvm-svn: 269282
This commit is contained in:
parent
194357c509
commit
a166979e45
|
@ -1652,7 +1652,7 @@ private:
|
|||
for (FormatToken *FormatTok = Line->First; FormatTok;
|
||||
FormatTok = FormatTok->Next) {
|
||||
StringRef Input = FormatTok->TokenText;
|
||||
if (!FormatTok->isStringLiteral() ||
|
||||
if (FormatTok->Finalized || !FormatTok->isStringLiteral() ||
|
||||
// NB: testing for not starting with a double quote to avoid
|
||||
// breaking
|
||||
// `template strings`.
|
||||
|
|
|
@ -1236,6 +1236,14 @@ TEST_F(FormatTestJS, RequoteStringsSingle) {
|
|||
// Code below fits into 15 chars *after* removing the \ escape.
|
||||
verifyFormat("var x = 'fo\"o';", "var x = \"fo\\\"o\";",
|
||||
getGoogleJSStyleWithColumns(15));
|
||||
verifyFormat("// clang-format off\n"
|
||||
"let x = \"double\";\n"
|
||||
"// clang-format on\n"
|
||||
"let x = 'single';\n",
|
||||
"// clang-format off\n"
|
||||
"let x = \"double\";\n"
|
||||
"// clang-format on\n"
|
||||
"let x = \"single\";\n");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, RequoteStringsDouble) {
|
||||
|
|
Loading…
Reference in New Issue