Lines Matching full:n

23     LLVM_DEBUG(llvm::errs() << "---\n");
24 LLVM_DEBUG(llvm::errs() << Code << "\n\n");
29 EXPECT_TRUE(Status.FormatComplete) << Code << "\n\n";
32 LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
42 EXPECT_EQ("int a;\n", format("int a; \n \n \n ", 0, 0));
47 EXPECT_EQ("{int b;\n"
48 " int a;\n"
50 format("{int b;\n int a;}", 8, 0));
51 EXPECT_EQ("{\n"
52 " int b;\n"
54 format("{int b;\n int a;}", 7, 0));
57 EXPECT_EQ("#define A \\\n"
58 " int a; \\\n"
60 format("#define A \\\n"
61 " int a; \\\n"
64 EXPECT_EQ("#define A \\\n"
65 " int a; \\\n"
67 format("#define A \\\n"
68 " int 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));
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));
89 "template <typename T> T *getFETokenInfo() const {\n"
90 " return static_cast<T *>(FETokenInfo);\n"
91 "}\n"
94 "template<typename T>\n"
95 "T *getFETokenInfo() const { return static_cast<T*>(FETokenInfo); }\n"
108 EXPECT_EQ("int a; // comment\n"
110 format("int a; // comment\n"
113 EXPECT_EQ("int a; // comment\n"
114 " // line 2\n"
116 format("int a; // comment\n"
117 " // line 2\n"
120 EXPECT_EQ("int a; // comment\n"
121 "// comment 2\n"
123 format("int a; // comment\n"
124 "// comment 2\n"
127 EXPECT_EQ("int aaaaaa; // comment\n"
128 "int b;\n"
130 format("int aaaaaa; // comment\n"
131 "int b;\n"
135 EXPECT_EQ("int a; // This\n"
136 " // is\n"
138 format("int a; // This\n"
139 " // is\n"
142 EXPECT_EQ("int a; // This\n"
143 " // is\n"
144 " // a\n"
145 "// This is b\n"
147 format("int a; // This\n"
148 " // is\n"
149 " // a\n"
150 "// This is b\n"
153 EXPECT_EQ("int a; // This\n"
154 " // is\n"
155 " // a\n"
156 "\n"
158 format("int a; // This\n"
159 " // is\n"
160 " // a\n"
161 "\n"
164 EXPECT_EQ("int a;\n"
165 "// This is\n"
167 format("int a;\n"
168 "// This is\n"
171 EXPECT_EQ("int x; // Format this line.\n"
172 "int xx; //\n"
174 format("int x; // Format this line.\n"
175 "int xx; //\n"
183 EXPECT_EQ("int i;\n"
184 "int b;\n"
185 "int c;\n"
186 "int d;\n"
187 "int e;\n"
189 format("int i;\n"
190 " int b;\n"
191 " int c;\n"
192 " int d;\n"
193 "int e;\n"
199 EXPECT_EQ("int i;\n"
200 "int f() {\n"
201 " int a;\n"
202 " int b;\n"
203 "}\n"
205 format("int i;\n"
206 " int f(){\n"
207 "int a;\n"
208 "int b;\n"
209 " }\n"
212 EXPECT_EQ("void f() {\n"
213 " if (foo) {\n"
214 " b();\n"
215 " } else {\n"
216 " c();\n"
217 " }\n"
218 "int d;\n"
220 format("void f() {\n"
221 " if (foo) {\n"
222 "b();\n"
223 "}else{\n"
224 "c();\n"
225 "}\n"
226 "int d;\n"
229 EXPECT_EQ("int i = []() {\n"
230 " class C {\n"
231 " int a;\n"
232 " int b;\n"
233 " };\n"
234 " int c;\n"
236 format("int i = []() {\n"
237 " class C{\n"
238 "int a;\n"
239 "int b;\n"
240 "};\n"
241 "int c;\n"
247 EXPECT_EQ("DEBUG({\n"
248 " int i;\n"
249 " int j;\n"
251 format("DEBUG( {\n"
252 " int i;\n"
253 " int j;\n"
256 EXPECT_EQ("DEBUG( {\n"
257 " int i;\n"
258 " int j;\n"
260 format("DEBUG( {\n"
261 " int i;\n"
262 " int j;\n"
265 EXPECT_EQ("DEBUG( {\n"
266 " int i;\n"
267 " int j;\n"
269 format("DEBUG( {\n"
270 " int i;\n"
271 " int j;\n"
274 EXPECT_EQ("DEBUG({\n"
275 " int i;\n"
276 " int j;\n"
278 format("DEBUG( {\n"
279 " int i;\n"
280 " int j;\n"
284 EXPECT_EQ("Debug({\n"
285 " if (aaaaaaaaaaaaaaaaaaaaaaaa)\n"
286 " return;\n"
287 " },\n"
289 format("Debug({\n"
290 " if (aaaaaaaaaaaaaaaaaaaaaaaa)\n"
291 " return;\n"
292 " },\n"
295 EXPECT_EQ("DEBUG({\n"
296 " DEBUG({\n"
297 " int a;\n"
298 " int b;\n"
299 " }) ;\n"
301 format("DEBUG({\n"
302 " DEBUG({\n"
303 " int a;\n"
304 " int b;\n" // Format this line only.
305 " }) ;\n" // Don't touch this line.
308 EXPECT_EQ("DEBUG({\n"
309 " int a; //\n"
311 format("DEBUG({\n"
312 " int a; //\n"
315 EXPECT_EQ("someFunction(\n"
316 " [] {\n"
317 " // Only with this comment.\n"
318 " int i; // invoke formatting here.\n"
319 " }, // force line break\n"
321 format("someFunction(\n"
322 " [] {\n"
323 " // Only with this comment.\n"
324 " int i; // invoke formatting here.\n"
325 " }, // force line break\n"
329 EXPECT_EQ("int longlongname; // comment\n"
330 "int x = f({\n"
331 " int x; // comment\n"
332 " int y; // comment\n"
334 format("int longlongname; // comment\n"
335 "int x = f({\n"
336 " int x; // comment\n"
337 " int y; // comment\n"
340 EXPECT_EQ("int s = f({\n"
341 " class X {\n"
342 " public:\n"
343 " void f();\n"
344 " };\n"
346 format("int s = f({\n"
347 " class X {\n"
348 " public:\n"
349 " void f();\n"
350 " };\n"
353 EXPECT_EQ("SomeFunction(\n"
354 " [] {\n"
355 " int i;\n"
356 " return i;\n" // Format this line.
357 " },\n"
358 " [] {\n"
359 " return 2;\n" // Don't fix this.
361 format("SomeFunction(\n"
362 " [] {\n"
363 " int i;\n"
364 " return i;\n" // Format this line.
365 " },\n"
366 " [] {\n"
367 " return 2;\n" // Don't fix this.
373 EXPECT_EQ("namespace {\n"
374 "int i;\n"
375 "int j;\n"
377 format("namespace {\n"
378 " int i;\n" // Format here.
379 " int j;\n"
382 EXPECT_EQ("namespace {\n"
383 " int i;\n"
384 " int j;\n"
386 format("namespace {\n"
387 " int i;\n"
388 " int j;\n" // Format here.
391 EXPECT_EQ("namespace {\n"
392 "class C {\n"
393 " int i;\n"
394 "};\n"
396 format("namespace {\n" // Format here.
397 " class C {\n"
398 " int i;\n"
399 " };\n"
406 EXPECT_EQ("int i;\n"
407 "#define A \\\n"
408 " int i; \\\n"
409 " int j\n"
411 format("int i;\n"
412 "#define A \\\n"
413 " int i ; \\\n"
414 " int j\n"
417 EXPECT_EQ("int i;\n"
418 "#define A \\\n"
419 " int i; \\\n"
420 " int j\n"
422 format("int i;\n"
423 "#define A \\\n"
424 " int i ; \\\n"
425 " int j\n"
431 EXPECT_EQ("{\n"
432 "{\n"
433 "a;\n"
434 "b;\n"
435 "}\n"
437 format("{\n"
438 "{\n"
439 "a;\n"
440 " b;\n"
441 "}\n"
444 EXPECT_EQ("{\n"
445 "{\n"
446 " a;\n"
447 " b;\n"
448 " c;\n"
449 " d;\n"
450 "}\n"
452 format("{\n"
453 "{\n"
454 " a;\n"
455 " b;\n"
456 " c;\n"
457 " d;\n"
458 "}\n"
461 EXPECT_EQ("{\n"
462 "{\n"
463 "public:\n"
464 " b;\n"
465 "}\n"
467 format("{\n"
468 "{\n"
469 "public:\n"
470 " b;\n"
471 "}\n"
474 EXPECT_EQ("{\n"
475 "{\n"
476 "a;\n"
477 "}\n"
478 "{\n"
479 " b; //\n"
480 "}\n"
482 format("{\n"
483 "{\n"
484 "a;\n"
485 "}\n"
486 "{\n"
487 " b; //\n"
488 "}\n"
491 EXPECT_EQ(" {\n"
492 " a; //\n"
494 format(" {\n"
495 "a; //\n"
498 EXPECT_EQ("void f() {}\n"
500 format("void f() {}\n"
503 EXPECT_EQ("int a; // comment\n"
504 " // line 2\n"
506 format("int a; // comment\n"
507 " // line 2\n"
511 EXPECT_EQ(" void f() {\n"
512 "#define A 1\n"
514 format(" void f() {\n"
515 " #define A 1\n" // Format this line.
518 EXPECT_EQ(" void f() {\n"
519 " int i;\n"
520 "#define A \\\n"
521 " int i; \\\n"
522 " int j;\n"
523 " int k;\n"
525 format(" void f() {\n"
526 " int i;\n"
527 "#define A \\\n"
528 " int i; \\\n"
529 " int j;\n"
530 " int k;\n" // Format this line.
535 EXPECT_EQ(" int a;\n"
536 " void\n"
537 " ffffff() {\n"
539 format(" int a;\n"
545 EXPECT_EQ("int a()\n"
546 "{\n"
547 "return 0;\n"
548 "}\n"
549 "int b()\n"
550 "{\n"
551 " return 42;\n"
553 format("int a()\n"
554 "{\n"
555 "return 0;\n"
556 "}\n"
557 "int b()\n"
558 "{\n"
559 "return 42;\n" // Format this line only
568 EXPECT_EQ("void f() {\n"
569 "\tf();\n"
570 "\tg();\n"
572 format("void f() {\n"
573 "\tf();\n"
574 "\tg();\n"
577 EXPECT_EQ("void f() {\n"
578 "\tf();\n"
579 "\tg();\n"
581 format("void f() {\n"
582 "\tf();\n"
583 "\tg();\n"
586 EXPECT_EQ("void f() {\n"
587 " \tf();\n"
588 "\tg();\n"
590 format("void f() {\n"
591 " \tf();\n"
592 " \tg();\n"
599 "void f() {\n"
600 " if (a) {\n"
601 " g();\n"
602 " h();\n"
603 " }\n"
604 "\n"
605 "void g() {\n"
607 format("void f() {\n"
608 " if (a) {\n" // Assume this was added without the closing brace.
609 " g();\n"
610 " h();\n"
611 "}\n"
612 "\n"
613 "void g() {\n" // Make sure not to format this.
620 EXPECT_EQ("var x = \"a\";\n"
621 "var x = 'a';\n"
623 format("var x = \"a\";\n"
624 "var x = \"a\";\n"
630 std::string Code = "#include <a> // line 1\n" // 23 chars long
631 " // line 2\n" // 23 chars long
632 "\n" // this newline is char 47
639 std::string Code = "void f() {\n"
640 " return a == 8 ? 32 : 16;\n"
641 "}\n";
647 Code = "\n"
648 "namespace ns1 { namespace ns2 {\n"
655 Code = "namespace ns {\n"
656 "#define REF(alias) alias alias_var;\n"
670 const StringRef Code{" class Foo {\n"
671 " void test() {\n"
672 " #ifdef 1\n"
673 " #define some\n" // format this line
674 " #endif\n"
679 EXPECT_EQ(" class Foo {\n"
680 " void test() {\n"
681 " #ifdef 1\n"
682 "#define some\n" // Formatted line
683 "#endif\n" // That this line is also formatted might be a bug.
689 EXPECT_EQ(" class Foo {\n"
690 " void test() {\n"
691 " #ifdef 1\n"
692 " #define some\n" // Formatted line
693 " #endif\n"
699 EXPECT_EQ(" class Foo {\n"
700 " void test() {\n"
701 " #ifdef 1\n"
702 "# define some\n" // Formatted line
703 "#endif\n" // That this line is also formatted might be a bug.