reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/unittests/Format/FormatTest.cpp
   70     EXPECT_EQ(Expected.str(), format(Expected, Style))
   72     EXPECT_EQ(Expected.str(), format(Code, Style));
   78       EXPECT_EQ(Expected.str(), format(test::messUp(Code), ObjCStyle));
   90               format(test::messUp(Code), Style, SC_ExpectIncomplete));
  105     format(Code, Style, SC_DoNotCheck);
  133   EXPECT_EQ(";", format(";"));
  137   EXPECT_EQ("int i;", format("  int i;"));
  138   EXPECT_EQ("\nint i;", format(" \n\t \v \f  int i;"));
  139   EXPECT_EQ("int i;\nint j;", format("    int i; int j;"));
  140   EXPECT_EQ("int i;\nint j;", format("    int i;\n  int j;"));
  144   EXPECT_EQ("int i;", format("int\ni;"));
  148   EXPECT_EQ("{\n  {\n    {}\n  }\n}", format("{{{}}}"));
  170             format("if(a){f();}"));
  175             format("if (a) {\n"
  182             format("/*\r\n"
  192             format("class C {\n"
  202             format("namespace N {\n"
  211             format("/* something */ namespace N {\n"
  220             format("inline namespace N {\n"
  229             format("/* something */ inline namespace N {\n"
  238             format("export namespace N {\n"
  247             format("extern /**/ \"C\" /**/ {\n"
  260             format("extern \"C\" int f() {\n"
  275             format("void f() {\n"
  290             format("void f() {\n"
  310             format("void f() {\n"
  328             format("namespace {\n"
  336             format("namespace {\n"
  344             format("namespace {\n"
  352             format("namespace {\n"
  360             format("namespace {\n"
  368             format("namespace {\n"
  387             format("class Foo\n"
  726             format("#define A \\\n"
 1125             format("DEBUG({\n"
 1145             format("switch (n)\n"
 1184             format("switch (n) {\n"
 1203             format("switch (n) {\n"
 1283             format("switch (a) {\n"
 1306             format("switch (a) {\n"
 1317             format("switch (a) {\n"
 1364             format("switch (n) {\n"
 1386             format("switch (n) {\n"
 1454             format("if(foo){bar();}", Style));
 1460             format("if(foo){bar();}else{baz();}", Style));
 1464             format("if(foo&&bar){baz();}", Style));
 1470             format("if(foo){bar();}else if(baz){quux();}", Style));
 1479       format("if(foo){bar();}else if(baz){quux();}else{foobar();}", Style));
 1483             format("for(;;){foo();}"));
 1487             format("while(1){foo();}", Style));
 1492             format("switch(foo){case bar:return;}", Style));
 1498             format("try{foo();}catch(...){bar();}", Style));
 1503             format("do{foo();}while(bar&&baz);", Style));
 1510             format("if(foo&&bar&&baz){quux();}", Style));
 1516             format("if (foo && bar &&\n"
 1528             format("if(foo){bar();}else if(baz||quux){foobar();}", Style));
 1539       format("if(foo){bar();}else if(baz||quux){foobar();}else{barbaz();}",
 1546             format("for(int i=0;i<10;++i){foo();}", Style));
 1552             format("while(foo||bar||baz){quux();}", Style));
 1559             format("switch(foo=barbaz){case quux:return;}", Style));
 1567             format("try{foo();}catch(Exception&bar){baz();}", Style));
 1647             format("class A {\n"
 1661             format("class A {\n"
 1676             format("#define B     \\\n"
 1689             format("#define A         private:\n"
 1808             format("enum KeepEmptyLines {\n"
 2060             format("#ifndef HEADER_GUARD\n"
 2071             format("namespace A::B {\n"
 2084             format("namespace out {\n"
 2099             format("namespace out {\n"
 2170             format("TESTSUITE(out) {\n"
 2178             format("TESTSUITE(out) {\n"
 2189             format("namespace out {\n"
 2198             format("TESTSUITE(out) {\n"
 2208             format("TESTSUITE(out) {\n"
 2226             format("namespace out {\n"
 2239             format("namespace out {\n"
 2254             format("namespace out { int i;\n"
 2261             format("namespace A { namespace B {\n"
 2271             format("namespace aaaaaaaaaa {\n"
 2280             format("namespace aaaaaa {\n"
 2292             format("namespace out {\n"
 2301             format("namespace out {\n"
 2311             format("namespace out {\n"
 2323             format("namespace out { namespace mid {\n"
 2332             format("namespace out {\n"
 2341             format("namespace out {\n"
 2405       format("void NS_InvokeByIndex(void *that,   unsigned int methodIndex) {\n"
 2416             format("_asm {\n"
 2427             format("__asm   {\n"
 2580             format("S s = {\n"
 2705             format("#define Q \"/aaaaaaaaa/aaaaaaaaaaaaaaaaaaa/aaaaaaaa.cpp\"",
 2711             format("   #     123    \"A string literal\""));
 2715   EXPECT_EQ("#;", format("#;"));
 2721             format("#  \\\n  line  \\\n  42  \\\n  \"test\"\n"));
 2722   EXPECT_EQ("#define A B\n", format("#  \\\n define  \\\n    A  \\\n       B\n",
 2728             format("#  \\\n  line  \\\n  42  \\\n  \"test\""));
 2729   EXPECT_EQ("#define A B", format("#  \\\n define  \\\n    A  \\\n       B"));
 2735   EXPECT_EQ("#define A \\ x20", format("#define A \\   x20"));
 2742             format("const char * c = STRINGIFY(\n"
 2771             format("  // somecomment\n"
 2780 TEST_F(FormatTest, LayoutSingleHash) { EXPECT_EQ("#\na;", format("#\na;")); }
 2787             format("#define A c; e;\n"
 2792 TEST_F(FormatTest, LayoutRemainingTokens) { EXPECT_EQ("{}", format("{}")); }
 2798             format("int x,\n#define A\ny;"));
 2802   EXPECT_EQ("#define A(c) L#c", format("#define A(c) L#c", getLLVMStyle()));
 2822   EXPECT_EQ("#define A (x)", format("#define A (x)"));
 2823   EXPECT_EQ("#define A(x)", format("#define A(x)"));
 2833   EXPECT_EQ("#define A b;", format("#define A \\\n"
 2841             format("#define A \\\n"
 2850             format("#define A \\\n"
 2903             format("class A  :  public QObject {\n"
 2910             format("MACRO\n"
 2916             format("SOME_MACRO\n"
 2921   EXPECT_EQ("HTTP f();", format("HTTP\nf();"));
 2922   EXPECT_EQ("MACRO\nf();", format("MACRO\nf();"));
 2927             format("class A  :  public QObject {\n"
 2934             format("SOME_WEIRD_LOG_MACRO\n"
 2944             format("/**/ FOO(a)\n"
 2955             format("  INITIALIZE_PASS_BEGIN(ScopDetection, \"polly-detect\")\n"
 2968             format("int q() {\n"
 2979             format("#define LIST(L) \\\n"
 3007             format("int q() {\n"
 3043             format("int q() {\n"
 3061             format("class A {\n"
 3075             format("void f() try {\n"
 3082             format("class SomeClass {\n"
 3092             format("class SomeClass {\n"
 3276             format("#ifndef NOT_GUARD\n"
 3293             format("#ifdef WIN32\n"
 3309             format("code();\n"
 3341     EXPECT_EQ(Expected, format(ToFormat, Style));
 3342     EXPECT_EQ(Expected, format(Expected, Style));
 3368     EXPECT_EQ(Expected, format(ToFormat, Style));
 3369     EXPECT_EQ(Expected, format(Expected, Style));
 3391     EXPECT_EQ(Expected, format(ToFormat, Style));
 3392     EXPECT_EQ(Expected, format(Expected, Style));
 3478     EXPECT_EQ(Expected, format(ToFormat, Style));
 3479     EXPECT_EQ(Expected, format(Expected, Style));
 3508     EXPECT_EQ(Expected, format(ToFormat, Style));
 3509     EXPECT_EQ(Expected, format(Expected, Style));
 3526             format("#define A { {\nint i;", getLLVMStyleWithColumns(11)));
 3528             format("#define A } }\nint i;", getLLVMStyleWithColumns(11)));
 3534             format("#define A \\\nint i;\\\n  int j;", Narrow));
 3535   EXPECT_EQ("#define A\n\nint i;", format("#define A \\\n\n int i;"));
 3536   EXPECT_EQ("template <class T> f();", format("\\\ntemplate <class T> f();"));
 3537   EXPECT_EQ("/* \\  \\  \\\n */", format("\\\n/* \\  \\  \\\n */"));
 3538   EXPECT_EQ("<a\n\\\\\n>", format("<a\n\\\\\n>"));
 3545             format("#define MACRO(x) \\\n"
 3552             format("#define A \\\r\nint i;\\\r\n  int j;", Narrow));
 3553   EXPECT_EQ("#define A\r\n\r\nint i;", format("#define A \\\r\n\r\n int i;"));
 3554   EXPECT_EQ("template <class T> f();", format("\\\ntemplate <class T> f();"));
 3555   EXPECT_EQ("/* \\  \\  \\\r\n */", format("\\\r\n/* \\  \\  \\\r\n */"));
 3556   EXPECT_EQ("<a\r\n\\\\\r\n>", format("<a\r\n\\\\\r\n>"));
 3560             format("#define MACRO(x) \\\r\n"
 3579             format("#define A \\\n"
 3607       format("  #define   ALooooooooooooooooooooooooooooooooooooooongMacro("
 3619             format("int\n#define A\na;"));
 3758             format("  SOME_MACRO  {int i;}  int i;"));
 3790             format("call(parameter, {\n"
 3796   EXPECT_EQ("DEBUG({ int i; });", format("DEBUG({ int   i; });"));
 3800             format("DEBUG({ // comment\n"
 3809             format("DEBUG({\n"
 3845             format("#define   MACRO()   Debug(aaa,  /* force line break */ \\\n"
 3854             format("#define A [] { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( \\\n"
 3860   EXPECT_EQ("{}", format("{}"));
 3865   EXPECT_EQ("void f() { }", format("void f() {}", Style));
 3867   EXPECT_EQ("while (true) { }", format("while (true) {}", Style));
 4155             format("return someVeryVeryLongConditionThatBarelyFitsOnALine && "
 4373             format("Constructor() :\n"
 4684             format("Constructor() :\n"
 4952             format("const aaaa::bbbbbbb\n"
 5175             format("f(g(h(a, // comment\n"
 5291             format("aaa(aaaa,\n" // one-per-line
 5300             format("aaa(aaaa,  aaaa,\n" // bin-packed
 5961             format("fun + \"1243\" /* comment */\n"
 5968       format("aaaaaa ="
 6251             format("x = \"a\\\n"
 6259             format("xxxx = \"a\\\n"
 6267             format("NSString *const kString = @\"aaaa\"\n"
 6343             format("llvm::errs() << \"\n<<a;"));
 6595             format("static_cast<A<//\n"
 6659             format("// Baseline - no comments.\n"
 6668             format("template <\n"
 6677       format("template <typename aaaaaaaaaa<bbbbbbbbbbbb>::value>  /* line */\n"
 6686       format("template <\n"
 6696       format(
 6799   EXPECT_EQ("A<A<A<A>>> a;", format("A<A<A<A> >> a;", getGoogleStyle()));
 6800   EXPECT_EQ("A<A<A<A>>> a;", format("A<A<A<A>> > a;", getGoogleStyle()));
 6801   EXPECT_EQ("A<::A<int>> a;", format("A< ::A<int>> a;", getGoogleStyle()));
 6802   EXPECT_EQ("A<::A<int>> a;", format("A<::A<int> > a;", getGoogleStyle()));
 6804             format("auto x=[]{A<A<A<A> >> a;};", getGoogleStyle()));
 6852             format("int    a=1<<2;  /* foo\n"
 6857             format("int  b  =256>>1 ;  /* foo\n"
 7357             format("#define OP(x) \\\n"
 7451             format("int *a;\n"
 7458             format("int* a;\n"
 7465             format("int *a;\n"
 7474             format("auto x=[]{int *a;\n"
 7831   EXPECT_EQ("#include \"a.h\"", format("#include  \"a.h\""));
 7832   EXPECT_EQ("#include <a>", format("#include<a>"));
 7897   EXPECT_EQ("void f() { return }", format("void  f ( )  {  return  }"));
 7902             format("void  f  (  )  {  if  ( a )  return  }"));
 7906             format("namespace  N  {  void f()  }"));
 7911             format("namespace N  { void f( ) { } void g( ) }"));
 7986   EXPECT_EQ("{\n  {}\n", format("{\n{\n}\n"));
 7987   EXPECT_EQ("{\n  {}\n", format("{\n  {\n}\n"));
 7988   EXPECT_EQ("{\n  {}\n", format("{\n  {\n  }\n"));
 7989   EXPECT_EQ("{\n  {}\n}\n}\n", format("{\n  {\n    }\n  }\n}\n"));
 7996             format("{\n"
 8141             format("static uint8 CddDp83848Reg[] = {CDDDP83848_BMCR_REGISTER,\n"
 8160             format("function({\n"
 8170             format("std::vector<int> MyNumbers{// First element:\n"
 8182             format("vector<int> SomeVector = { // aaa\n"
 8274             format("vector<int>x{1,2,3,4};", SpaceBetweenBraces));
 8278             format("vector<int>x{1,2,3,4};", SpaceBetweenBraces));
 8285             format("vector<int>x{1,2,3,4,};", SpaceBetweenBraces));
 8495   EXPECT_EQ("A() : b(0) {}", format("A():b(0){}", NoColumnLimit));
 8499             format("class C{A():b(0){}};", NoColumnLimit));
 8503             format("A()\n:b(0)\n{\n}", NoColumnLimit));
 8511             format("A():b(0){}", DoNotMergeNoColumnLimit));
 8515             format("A()\n:b(0)\n{\n}", DoNotMergeNoColumnLimit));
 8970             format("#error Leave     all         white!!!!! space* alone!\n"));
 8973       format("#warning Leave     all         white!!!!! space* alone!\n"));
 8974   EXPECT_EQ("#error 1", format("  #  error   1"));
 8975   EXPECT_EQ("#warning 1", format("  #  warning 1"));
 9000             format("if (true)\nreturn 42;", AllowsMergedIf));
 9095             format(std::string("int    i;\n") + Code + "int    j;\n",
 9106             format("-(NSUInteger)indexOfObject:(id)anObject;"));
 9107   EXPECT_EQ("- (NSInteger)Mthod1;", format("-(NSInteger)Mthod1;"));
 9108   EXPECT_EQ("+ (id)Mthod2;", format("+(id)Mthod2;"));
 9110             format("-(NSInteger)Method3:(id)anObject;"));
 9112             format("-(NSInteger)Method4:(id)anObject;"));
 9114             format("-(NSInteger)Method5:(id)anObject:(id)AnotherObject;"));
 9116             format("- (id)Method6:(id)A:(id)B:(id)C:(id)D;"));
 9119             format("- (void)sendAction:(SEL)aSelector to:(id)anObject "
 9174             format("\"some text other\";", getLLVMStyleWithColumns(12)));
 9177             format("\\\n\"some text other\";", getLLVMStyleWithColumns(12)));
 9183       format("#define A \"some text other\";", getLLVMStyleWithColumns(12)));
 9189       format("#define A \"so text other\";", getLLVMStyleWithColumns(12)));
 9192             format("\"some text\"", getLLVMStyleWithColumns(1)));
 9194             format("\"some text\"", getLLVMStyleWithColumns(11)));
 9197             format("\"some text\"", getLLVMStyleWithColumns(10)));
 9200             format("\"some text\"", getLLVMStyleWithColumns(7)));
 9204             format("\"some text\"", getLLVMStyleWithColumns(6)));
 9208             format("\"some tex and\"", getLLVMStyleWithColumns(6)));
 9212             format("\"some/tex/and\"", getLLVMStyleWithColumns(6)));
 9217             format("variable = \"long string literal\";",
 9225             format("variable = f(\"long string literal\", short, "
 9233       format("f(g(\"long string literal\"), b);", getLLVMStyleWithColumns(20)));
 9238             format("f(g(\"long string literal\", a), b);",
 9243       format("f(\"one two\".split(variable));", getLLVMStyleWithColumns(20)));
 9247             format("f(\"one two three four five six seven\"."
 9254             format("f(\"some text\", other);", getLLVMStyleWithColumns(10)));
 9265             format("\"splitmeatrandompoint\"", getLLVMStyleWithColumns(10)));
 9270             format("\"split/pathat/slashes\"", getLLVMStyleWithColumns(10)));
 9275             format("\"split/pathat/slashes\"", getLLVMStyleWithColumns(10)));
 9282             format("\"split at "
 9296             format("aaaaaaaaaaaa(\"aaaaaaaaaaaaaaaaaaaaaaaaaa "
 9302             format("return \"aaaaaaaaaaaaaaaaaaaaaa "
 9308             format("llvm::outs() << "
 9314             format("ffff({\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "
 9320   EXPECT_EQ("\"some text other\";", format("\"some text other\";", Style));
 9328             format("#define A \"some text other\";", AlignLeft));
 9334             format("C a = \"some more text\";", getLLVMStyleWithColumns(18)));
 9341             format("int i=a(\n\n b(\n\n\n )\n\n);", NoEmptyLines));
 9349       format("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
 9358       format("u8\"utf8 string literal\";", getGoogleStyleWithColumns(16)));
 9362       format("u\"utf16 string literal\";", getGoogleStyleWithColumns(16)));
 9366       format("U\"utf32 string literal\";", getGoogleStyleWithColumns(16)));
 9369             format("L\"wide string literal\";", getGoogleStyleWithColumns(16)));
 9372             format("@\"NSString literal\";", getGoogleStyleWithColumns(19)));
 9384   EXPECT_EQ("R\"x(raw literal)x\";", format("R\"x(raw literal)x\";", Style));
 9385   EXPECT_EQ("uR\"x(raw literal)x\";", format("uR\"x(raw literal)x\";", Style));
 9386   EXPECT_EQ("LR\"x(raw literal)x\";", format("LR\"x(raw literal)x\";", Style));
 9387   EXPECT_EQ("UR\"x(raw literal)x\";", format("UR\"x(raw literal)x\";", Style));
 9389             format("u8R\"x(raw literal)x\";", Style));
 9398       format("  _T(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")", Style));
 9403             format("f(x, _T(\"aaaaaaaaaaaaaaa\"), z);", Style));
 9414       format("  _T ( \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" )", Style));
 9420             format("f(\n"
 9428             format("f(\n"
 9439       format("func(a, \"long long long long\");", getLLVMStyleWithColumns(24)));
 9446             format("func(a, \"long long long long\", c);",
 9453             format("func(a, b, \"long long long long\");",
 9462             format("func(a, \"long long long long\", \"long long long long\");",
 9468             format("a << \"line line line\";", getLLVMStyleWithColumns(20)));
 9475       format("abcde << \"line line line\" << c;", getLLVMStyleWithColumns(20)));
 9482       format("a << b << \"line line line\";", getLLVMStyleWithColumns(20)));
 9489             format("abcd << \"line line line\" << \"line line line\";",
 9496       format("abcd + \"line line line line\";", getLLVMStyleWithColumns(20)));
 9503             format("abcd + \"line line line line\" + e;",
 9513             format("someFunction(\"long long long long\", a);", Style));
 9521       format("aaaaaaaaaaa  =  \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\\n"
 9528             format("f(g(R\"x(raw literal)x\",   a), b);", getGoogleStyle()));
 9534             format("fffffffffff(g(R\"x(\n"
 9544             format("fffffffffff(g(R\"x(qqq\n"
 9552             format("fffffffffff(R\"x(\n"
 9559             format("fffffffffff(R\"x(\n"
 9568             format("fffffffffff(\n"
 9574             format("fffffffffff(\n"
 9582             format("function(  \"unterminated,\n"
 9590             format("#define x(_a) printf(\"foo\"_a);", Style));
 9611             format("someFunction(\"aaabbbcccdddeeefff\");",
 9615             format("someFunction1234567890(\"aaabbbcccdddeeefff\");",
 9620             format("someFunction1234567890(\"aaabbbcccdddeeefff\");",
 9625             format("someFunction1234567890(\"aaabbbcccdddeeefff\");",
 9630             format("someFunction(\"aaabbbcc ddde efff\");",
 9634             format("someFunction(\"aaabbbccc ddeeefff\");",
 9639             format("someFunction1234567890(\"aaabb cccdddeeefff\");",
 9646             format("#define A string s = \"1234567890\"; int i;",
 9651             format("someFunction(\"aaabbbcc dddeeefff\");",
 9656   EXPECT_EQ("\"\\a\"", format("\"\\a\"", getLLVMStyleWithColumns(3)));
 9657   EXPECT_EQ("\"\\\"", format("\"\\\"", getLLVMStyleWithColumns(2)));
 9660             format("\"test\\n\"", getLLVMStyleWithColumns(7)));
 9663             format("\"tes\\\\n\"", getLLVMStyleWithColumns(7)));
 9666             format("\"\\\\\\\\\\n\"", getLLVMStyleWithColumns(7)));
 9667   EXPECT_EQ("\"\\uff01\"", format("\"\\uff01\"", getLLVMStyleWithColumns(7)));
 9670             format("\"\\uff01test\"", getLLVMStyleWithColumns(8)));
 9672             format("\"\\Uff01ff02\"", getLLVMStyleWithColumns(11)));
 9675             format("\"\\x000000000001next\"", getLLVMStyleWithColumns(16)));
 9677             format("\"\\x000000000001next\"", getLLVMStyleWithColumns(15)));
 9679             format("\"\\x000000000001\"", getLLVMStyleWithColumns(7)));
 9683             format("\"test\\000000000001\"", getLLVMStyleWithColumns(9)));
 9687             format("\"test\\000000000001\"", getLLVMStyleWithColumns(10)));
 9749             format("if (aaaaaaaa &&// q\n"
 9755             format("if(aaa&&bbb)// w\n"
 9813             format("   /*\t \t \n"
 9838             format("if (aaaaaaaa &&// q\n"
 9863             format("{\n"
 9874             format("{\n"
 9884             format("{\n"
 9894             format("{\n"
 9905             format("{\n"
 9916             format("{\n"
 9928             format("   /*\t \t \n"
 9935             format(" \t \t /* some\n"
 9940             format(" \t \t int a; /* some\n"
 9946             format(" \t \t int\ta; /* some\n"
 9951             format(" \t \t f(\"\t\t\"); /* some\n"
 9960             format("{\n"
 9973             format("if (aaaaaaaa &&// q\n"
 9979             format("if(aaa&&bbb)// w\n"
10029             format("   /*\t \t \n"
10052             format("if (aaaaaaaa &&// q\n"
10077             format("{\n"
10088             format("{\n"
10098             format("{\n"
10108             format("{\n"
10119             format("{\n"
10130             format("{\n"
10140             format("   /*\t \t \n"
10147             format(" \t \t /* some\n"
10152             format(" \t \t int a; /* some\n"
10157             format(" \t \t int\ta; /* some\n"
10162             format(" \t \t f(\"\t\t\"); /* some\n"
10171             format("{\n"
10200             format("void a(){\n"
10208             format("void a(){\n"
10217             format("void a(){\n"
10225             format("void a(){\n"
10234             format("void a(){\n"
10242             format("void a(){\n"
10251             format("void a(){\n"
10259             format("void a(){\n"
10269             format("  \"qqqqqqqqqqqqqqqqqqqqqqqqqq\\\n"
10276             format("// qqqqqqqqqqqqqqqqqqqqqqqqqq\n"
10284             format("// qqqqqqqqqqqqqqqqqqqqqqqqqq\\\n"
10292             format("  inttt qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\\\n"
10871             format("int a       = 5;\n"
10879             format("int a = 5;\n"
10889             format("int a = 5;\n"
11047             format("float const   a = 5;\n"
11055             format("float    a = 5;\n"
11065             format("float    a = 5;\n"
11086             format("int a(int x,\n"
11097             format("double a(int x);\n"
11164             format("void SomeFunction(int parameter= 0) {\n"
11347             format("DECOR1 /**/ int8_t /**/ DECOR2 /**/ foo (int a);", Style));
11507             format("namespace a\n"
12159             format("#pragma    mark   Any non-hyphenated or hyphenated string "
12166   EXPECT_EQ("#pragma option -C -A", format("#pragma    option   -C   -A"));
12178             format("/*\n"
12186             format("/*\n"
12199             format("int a; /* first line\n"
12209             format("int a; // first line\n"
12218             format("int a; // the comment aaa", Style));
12223             format("int a; /* first line\n"
12231             format("int a; // first line\n"
12241             format("int a; /* first line second line third line"
12247             format("// foo bar baz bazfoo\n"
12252             format("// foo bar baz      bazfoo\n"
12260             format("// foo bar baz      bazfoo bar\n"
12267             format("// foo bar baz      bazfoo\n"
12275             format("// foo bar baz      bazfoo\n"
12287       format("// foo foo foo foo foo foo foo foo foo foo foo foo\n", Style));
12292             format("int a = /* long block comment */ 42;", Style));
12957             format("\"\xce\xe4\xed\xe0\xe6\xe4\xfb \xe2 "
12964   EXPECT_EQ("\xef\xbb\xbf", format("\xef\xbb\xbf"));
12966             format("\xef\xbb\xbf#include <iostream>"));
12968             format("\xef\xbb\xbf\n#include <iostream>"));
12995             format("\"aaaaÄ\xc2\x8d\";", getLLVMStyleWithColumns(10)));
12998             format("\"aaaaaaaÄ\xc2\x8d\";", getLLVMStyleWithColumns(10)));
13003             format("\"Однажды, в студёную зимнюю пору,\"",
13010       format("\"一 二 三 四 五六 七 八 九 十\"", getLLVMStyleWithColumns(11)));
13018             format("\"一\t二 \t三 四 五\t六 \t七 八九十\tqq\"",
13024             format("\"aaaaaa\\\xC2\x8D\"", getLLVMStyleWithColumns(10)));
13031             format("const char *sssss = \"一二三四五六七八\\\n"
13038             format("// aaaaÄ\xc2\x8d", getLLVMStyleWithColumns(10)));
13043             format("// Я из лесу вышел; был сильный мороз.",
13049             format("// 一二三 四五六七 八  九 十", getLLVMStyleWithColumns(9)));
13061             format("/* Гляжу, поднимается медленно в гору\n"
13069       format("/* 一二三 四五六七 八  九 十  */", getLLVMStyleWithColumns(9)));
13073             format("/* 𝓣𝓮𝓼𝓽 𝔣𝔬𝔲𝔯 𝕓𝕪𝕥𝕖 𝖀𝕿𝕱-𝟠 */", getLLVMStyleWithColumns(12)));
13235             format("void f() {\n"
13247   EXPECT_EQ("void f() { }", format("void f() {}", Style));
13248   EXPECT_EQ("while (true) { }", format("while (true) {}", Style));
13253             format("while (true) { continue; }", Style));
13274             format("SomeClass::Constructor():a(a){}", Style));
13305             format("ASSERT ( aaaa\n||bbbb);", Style));
13312             format("if (aaaaaaaaaaaaaaa\n"
13318             format("if (aaaaaaaaaaaaaaa || bbbbbbbbbbbbbbb) { i++; }", Style));
13325             format("#define aNumber \\\n"
13332             format("NSArray*a=[[NSArray alloc] initWithArray:@[]\n"
13337             format("NSArray*a=[[NSArray alloc]initWithArray:@[ @\"a\" ]\n"
13347             format("NSArray* a = [[NSArray alloc] initWithArray:@[\n"
13356       format("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\", @\"a\" ]\n"
13363             format("[self.a b:c\n"
13409             format("SomeFunction([](){\n"
13892             format("[[SessionService sharedService]\n"
13930             format("void   (^largeBlock)(void) = ^{ int   i; };", ZeroColumn));
13935             format("void   (^largeBlock)(void) = ^{ int   i; };", ZeroColumn));
13942             format("int a;\r\n"
13949             format("int a;\r\n"
13956             format("int a;\r\n"
13962             format("\"aaaaaaa bbbbbbb\";\r\n", getLLVMStyleWithColumns(10)));
13967             format("#define A \\\r\n"
13977             format("/*\r\n"
13985             format("/*\r\n"
14004             format("int i = longFunction(arg);", TwoIndent));
14012             format("int i = longFunction(arg);", SixIndent));
14069   EXPECT_EQ("f<<<1, 1>>>();", format("f <<< 1, 1 >>> ();"));
14072   EXPECT_EQ("f<param><<<1, 1>>>();", format("f< param > <<< 1, 1 >>> ();"));
14081   EXPECT_EQ("< < <", format("\\\n<<<"));
14099   EXPECT_EQ(code, format(code));
14116             format("int a;\n"
14141             format("void f() {\n"
14156             format("<<<<<<<\n"
14166             format("<<<<<<<\n"
14182             format("#define Macro \\\n"
14200             format(" int  i;\n"
14210             format(" int  i;\n"
14226             format("// clang-format off\n"
14237   format("? ) =");
14249             format("auto a = new unique_ptr<int > [ 10];"));
14254             format("auto a = new unique_ptr<int > [10];", Spaces));
14259             format("auto a = unique_ptr < Foo < Bar>[ 10]> ;"));
14264             format("auto a = unique_ptr < Foo < Bar>[10]> ;", Spaces));
14421             format("using std::cout;\n"
14430   EXPECT_EQ("auto c = u8 'a';", format("auto c = u8'a';", Style));
14436   EXPECT_EQ("auto c = u8'a';", format("auto c = u8'a';"));
14440   EXPECT_EQ("<!-- ;> -->", format("<!-- ;> -->", getGoogleStyle()));
14441   EXPECT_EQ(" <!-- >; -->", format(" <!-- >; -->", getGoogleStyle()));
14448   EXPECT_EQ("auto [a, b] = f();", format("auto[a, b] = f();"));
14449   EXPECT_EQ("const auto [a, b] = f();", format("const   auto[a, b] = f();"));
14450   EXPECT_EQ("auto const [a, b] = f();", format("auto  const[a, b] = f();"));
14452             format("auto  const   volatile[a, b] = f();"));
14453   EXPECT_EQ("auto [a, b, c] = f();", format("auto   [  a  ,  b,c   ] = f();"));
14455             format("auto   &[  a  ,  b,c   ] = f();"));
14457             format("auto   &&[  a  ,  b,c   ] = f();"));
14458   EXPECT_EQ("auto const &[a, b] = f();", format("auto  const&[a, b] = f();"));
14460             format("auto  const  volatile  &&[a, b] = f();"));
14462             format("auto  const   &&  [a, b] = f();"));
14464             format("const  auto  &  [a, b] = f();"));
14466             format("const  auto   volatile  &&[a, b] = f();"));
14468             format("volatile  const  auto   &&[a, b] = f();"));
14470             format("const  auto  &&  [a, b] = f();"));
14489             format("for (const auto   &&   [a, b] : some_range) {\n}"));
14491             format("for (const auto   &   [a, b] : some_range) {\n}"));
14493             format("for (const auto[a, b] : some_range) {\n}"));
14494   EXPECT_EQ("auto [x, y](expr);", format("auto[x,y]  (expr);"));
14495   EXPECT_EQ("auto &[x, y](expr);", format("auto  &  [x,y]  (expr);"));
14496   EXPECT_EQ("auto &&[x, y](expr);", format("auto  &&  [x,y]  (expr);"));
14498             format("auto  const  &  [x,y]  (expr);"));
14500             format("auto  const  &&  [x,y]  (expr);"));
14501   EXPECT_EQ("auto [x, y]{expr};", format("auto[x,y]     {expr};"));
14503             format("auto  const  &  [x,y]  {expr};"));
14505             format("auto  const  &&  [x,y]  {expr};"));