aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 806707cb4c..6b77868776 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1537,6 +1537,16 @@ TEST_F(FormatTest, DoNotInterfereWithErrorAndWarning) {
EXPECT_EQ("#warning 1", format(" # warning 1"));
}
+TEST_F(FormatTest, MergeHandlingInTheFaceOfPreprocessorDirectives) {
+ FormatStyle AllowsMergedIf = getGoogleStyle();
+ AllowsMergedIf.AllowShortIfStatementsOnASingleLine = true;
+ verifyFormat("void f() { f(); }\n#error E", AllowsMergedIf);
+ verifyFormat("if (true) return 42;\n#error E", AllowsMergedIf);
+
+ // FIXME:
+ // verifyFormat("if (true)\n#error E\n return 42;", AllowsMergedIf);
+}
+
// FIXME: This breaks the order of the unwrapped lines:
// TEST_F(FormatTest, OrderUnwrappedLines) {
// verifyFormat("{\n"