diff options
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r-- | clang/unittests/Format/ConfigParseTest.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 99 |
2 files changed, 0 insertions, 100 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index f7ab554..2b08b79 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -295,7 +295,6 @@ TEST(ConfigParseTest, ParsesConfiguration) { FormatStyle Style = {}; Style.Language = FormatStyle::LK_Cpp; CHECK_PARSE("CommentPragmas: '// abc$'", CommentPragmas, "// abc$"); - CHECK_PARSE("OneLineFormatOffRegex: // ab$", OneLineFormatOffRegex, "// ab$"); Style.QualifierAlignment = FormatStyle::QAS_Right; CHECK_PARSE("QualifierAlignment: Leave", QualifierAlignment, diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index c4fcc55..333d40d 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -24954,105 +24954,6 @@ TEST_F(FormatTest, DisableRegions) { "// clang-format on"); } -TEST_F(FormatTest, OneLineFormatOffRegex) { - auto Style = getLLVMStyle(); - Style.OneLineFormatOffRegex = "// format off$"; - - verifyFormat(" // format off\n" - " int i ;\n" - "int j;", - " // format off\n" - " int i ;\n" - " int j ;", - Style); - verifyFormat("// format off?\n" - "int i;", - " // format off?\n" - " int i ;", - Style); - verifyFormat("f(\"// format off\");", " f(\"// format off\") ;", Style); - - verifyFormat("int i;\n" - " // format off\n" - " int j ;\n" - "int k;", - " int i ;\n" - " // format off\n" - " int j ;\n" - " int k ;", - Style); - - verifyFormat(" // format off\n" - "\n" - "int i;", - " // format off\n" - " \n" - " int i ;", - Style); - - verifyFormat("int i;\n" - " int j ; // format off\n" - "int k;", - " int i ;\n" - " int j ; // format off\n" - " int k ;", - Style); - - verifyFormat("// clang-format off\n" - " int i ;\n" - " int j ; // format off\n" - " int k ;\n" - "// clang-format on\n" - "f();", - " // clang-format off\n" - " int i ;\n" - " int j ; // format off\n" - " int k ;\n" - " // clang-format on\n" - " f() ;", - Style); - - Style.OneLineFormatOffRegex = "^/\\* format off \\*/"; - verifyFormat("int i;\n" - " /* format off */ int j ;\n" - "int k;", - " int i ;\n" - " /* format off */ int j ;\n" - " int k ;", - Style); - verifyFormat("f(\"/* format off */\");", " f(\"/* format off */\") ;", Style); - - Style.AlignEscapedNewlines = FormatStyle::ENAS_DontAlign; - verifyFormat("#define A \\\n" - " do { \\\n" - " /* format off */\\\n" - " f() ; \\\n" - " g(); \\\n" - " } while (0)", - "# define A\\\n" - " do{ \\\n" - " /* format off */\\\n" - " f() ; \\\n" - " g() ;\\\n" - " } while (0 )", - Style); - - Style.ColumnLimit = 50; - Style.OneLineFormatOffRegex = "^LogErrorPrint$"; - verifyFormat(" myproject::LogErrorPrint(logger, \"Don't split me!\");\n" - "myproject::MyLogErrorPrinter(myLogger,\n" - " \"Split me!\");", - " myproject::LogErrorPrint(logger, \"Don't split me!\");\n" - " myproject::MyLogErrorPrinter(myLogger, \"Split me!\");", - Style); - - Style.OneLineFormatOffRegex = "//(< clang-format off| NO_TRANSLATION)$"; - verifyNoChange( - " int i ; //< clang-format off\n" - " msg = sprintf(\"Long string with placeholders.\"); // NO_TRANSLATION", - Style); -} - TEST_F(FormatTest, DoNotCrashOnInvalidInput) { format("? ) ="); verifyNoCrash("#define a\\\n /**/}"); |