Home | History | Annotate | Download | only in Format

Lines Matching refs:format

1 //===- unittest/Format/FormatTestSelective.cpp - Formatting unit tests ----===//
11 #include "clang/Format/Format.h"
15 #define DEBUG_TYPE "format-test"
18 namespace format {
23 std::string format(llvm::StringRef Code, unsigned Offset, unsigned Length) {
41 EXPECT_EQ("int a;\nint b;", format("int a; \nint b;", 0, 0));
42 EXPECT_EQ("int a;", format("int a; ", 0, 0));
43 EXPECT_EQ("int a;\n", format("int a; \n \n \n ", 0, 0));
44 EXPECT_EQ("int a;\nint b; ", format("int a; \nint b; ", 0, 0));
51 format("{int b;\n int a;}", 8, 0));
55 format("{int b;\n int a;}", 7, 0));
61 format("#define A \\\n"
68 format("#define A \\\n"
75 EXPECT_EQ("int b;\n\nint a;", format("int b;\n\nint a;", 8, 0));
76 EXPECT_EQ("int b;\n\nint a;", format("int b;\n\nint a;", 7, 0));
80 EXPECT_EQ("int b;\nint a;", format("int b;int a;", 7, 0));
84 EXPECT_EQ("int a;\n\n int b;", format("int a;\n \n\n int b;", 8, 0));
85 EXPECT_EQ("int a;\n\n int b;", format("int a;\n \n\n int b;", 9, 0));
94 format(
103 EXPECT_EQ("if (a) return;", format("if(a)\nreturn;", 7, 1));
105 format("if(a)\nreturn; // comment", 20, 1));
111 format("int a; // comment\n"
117 format("int a; // comment\n"
124 format("int aaaaaa; // comment\n"
132 format("int a; // This\n"
141 format("int a; // This\n"
152 format("int a; // This\n"
161 format("int a;\n"
172 format("DEBUG( {\n"
181 format("DEBUG( {\n"
190 format("DEBUG( {\n"
199 format("DEBUG( {\n"
210 format("Debug({\n"
222 format("DEBUG({\n"
225 " int b;\n" // Format this line only.
232 format("DEBUG({\n"
242 format("someFunction(\n"
255 format("int longlongname; // comment\n"
267 format("int s = f({\n"
281 format("namespace {\n"
282 " int i;\n" // Format here.
290 format("namespace {\n"
292 " int j;\n" // Format here.
304 format("int i;\n"
315 format("int i;\n"
330 format("{\n"
345 format("{\n"
360 format("{\n"
375 format("{\n"
387 format(" {\n"
393 format("void f() {}\n"
399 format("int a; // comment\n"
407 format(" void f() {\n"
408 " #define A 1\n" // Format this line.
418 format(" void f() {\n"
423 " int k;\n" // Format this line.
432 format(" int a;\n"
445 format("void f() {\n"
454 format("void f() {\n"
463 format("void f() {\n"
480 format("void f() {\n"
486 "void g() {\n" // Make sure not to format this.
492 } // end namespace format