summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 0d85789a1dd..dfc88fa8f79 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3216,6 +3216,24 @@ TEST_F(FormatTest, PutEmptyBlocksIntoOneLine) {
verifyFormat("enum E {}");
}
+TEST_F(FormatTest, FormatBeginBlockEndMacros) {
+ FormatStyle Style = getLLVMStyle();
+ Style.MacroBlockBegin = "^[A-Z_]+_BEGIN$";
+ Style.MacroBlockEnd = "^[A-Z_]+_END$";
+ verifyFormat("FOO_BEGIN\n"
+ " FOO_ENTRY\n"
+ "FOO_END", Style);
+ verifyFormat("FOO_BEGIN\n"
+ " NESTED_FOO_BEGIN\n"
+ " NESTED_FOO_ENTRY\n"
+ " NESTED_FOO_END\n"
+ "FOO_END", Style);
+ verifyFormat("FOO_BEGIN(Foo, Bar)\n"
+ " int x;\n"
+ " x = 1;\n"
+ "FOO_END(Baz)", Style);
+}
+
//===----------------------------------------------------------------------===//
// Line break tests.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud