Don't re-format raw string literal contents when formatting is disable
Not entirely sure this is the best place to put this check, but it fixes
the immediate issue.
llvm-svn: 327253
diff --git a/clang/unittests/Format/FormatTestRawStrings.cpp b/clang/unittests/Format/FormatTestRawStrings.cpp
index daef6d7..85f0aab 100644
--- a/clang/unittests/Format/FormatTestRawStrings.cpp
+++ b/clang/unittests/Format/FormatTestRawStrings.cpp
@@ -164,6 +164,20 @@
getRawStringPbStyleWithColumns(40)));
}
+TEST_F(FormatTestRawStrings, RespectsClangFormatOff) {
+ expect_eq(R"test(
+// clang-format off
+s = R"pb(item: 1)pb";
+// clang-format on
+t = R"pb(item: 1)pb";)test",
+ format(R"test(
+// clang-format off
+s = R"pb(item: 1)pb";
+// clang-format on
+t = R"pb(item: 1)pb";)test",
+ getRawStringPbStyleWithColumns(40)));
+}
+
TEST_F(FormatTestRawStrings, ReformatsShortRawStringsOnSingleLine) {
expect_eq(
R"test(P p = TP(R"pb()pb");)test",