Lines Matching +defs:clang +defs:format
10 #include "clang/Format/Format.h"
14 #define DEBUG_TYPE "format-test"
16 namespace clang {
17 namespace format {
22 std::string format(StringRef Code, unsigned Offset, unsigned Length) {
40 EXPECT_EQ("int a;\nint b;", format("int a; \nint b;", 0, 0));
41 EXPECT_EQ("int a;", format("int a; ", 0, 0));
42 EXPECT_EQ("int a;\n", format("int a; \n \n \n ", 0, 0));
43 EXPECT_EQ("int a;\nint b; ", format("int a; \nint b; ", 0, 0));
50 format("{int b;\n int a;}", 8, 0));
54 format("{int b;\n int a;}", 7, 0));
60 format("#define A \\\n"
67 format("#define A \\\n"
74 EXPECT_EQ("int b;\n\nint a;", format("int b;\n\nint a;", 8, 0));
75 EXPECT_EQ("int b;\n\nint a;", format("int b;\n\nint a;", 7, 0));
79 EXPECT_EQ("int b;\nint a;", format("int b;int a;", 7, 0));
83 EXPECT_EQ("int a;\n\n int b;", format("int a;\n \n\n int b;", 8, 0));
84 EXPECT_EQ("int a;\n\n int b;", format("int a;\n \n\n int b;", 9, 0));
93 format(
102 EXPECT_EQ("if (a) return;", format("if(a)\nreturn;", 7, 1));
104 format("if(a)\nreturn; // comment", 20, 1));
110 format("int a; // comment\n"
116 format("int a; // comment\n"
123 format("int a; // comment\n"
130 format("int aaaaaa; // comment\n"
138 format("int a; // This\n"
147 format("int a; // This\n"
158 format("int a; // This\n"
167 format("int a;\n"
174 format("int x; // Format this line.\n"
189 format("int i;\n"
205 format("int i;\n"
220 format("void f() {\n"
236 format("int i = []() {\n"
251 format("DEBUG( {\n"
260 format("DEBUG( {\n"
269 format("DEBUG( {\n"
278 format("DEBUG( {\n"
289 format("Debug({\n"
301 format("DEBUG({\n"
311 format("DEBUG({\n"
321 format("someFunction(\n"
334 format("int longlongname; // comment\n"
346 format("int s = f({\n"
361 format("SomeFunction(\n"
377 format("namespace {\n"
386 format("namespace {\n"
396 format("namespace {\n" // Format here.
411 format("int i;\n"
422 format("int i;\n"
437 format("{\n"
452 format("{\n"
467 format("{\n"
482 format("{\n"
494 format(" {\n"
500 format("void f() {}\n"
506 format("int a; // comment\n"
514 format(" void f() {\n"
525 format(" void f() {\n"
539 format(" int a;\n"
553 format("int a()\n"
572 format("void f() {\n"
581 format("void f() {\n"
590 format("void f() {\n"
607 format("void f() {\n"
613 "void g() {\n" // Make sure not to format this.
623 format("var x = \"a\";\n"
634 EXPECT_EQ(Code, format(Code, 47, 1));
642 EXPECT_EQ(Code, format(Code, 40, 0));
650 EXPECT_EQ(Code, format(Code, 0, 0));
658 EXPECT_EQ(Code, format(Code, 51, 0));
662 // clang-format currently does not (or should not) take into account the
673 " #define some\n" // format this line
685 format(Code, 57, 0));
695 format(Code, 57, 0));
705 format(Code, 57, 0));
709 } // end namespace format
710 } // end namespace clang