• Home
  • Raw
  • Download

Lines Matching full:style

22                             unsigned Length, const FormatStyle &Style) {  in format()  argument
26 tooling::Replacements Replaces = reformat(Style, Code, Ranges); in format()
35 const FormatStyle &Style = getMicrosoftStyle(FormatStyle::LK_CSharp)) { in format() argument
36 return format(Code, 0, Code.size(), Style); in format()
40 FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp); in getStyleWithColumns() local
41 Style.ColumnLimit = ColumnLimit; in getStyleWithColumns()
42 return Style; in getStyleWithColumns()
47 const FormatStyle &Style = getMicrosoftStyle(FormatStyle::LK_CSharp)) { in verifyFormat() argument
48 EXPECT_EQ(Code.str(), format(Code, Style)) << "Expected code is not stable"; in verifyFormat()
49 EXPECT_EQ(Code.str(), format(test::messUp(Code), Style)); in verifyFormat()
75 // (Google C++-like) brace-breaking style. in TEST_F()
76 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
77 Style.BreakBeforeBraces = FormatStyle::BS_Attach; in TEST_F()
79 verifyFormat("public class SomeEmptyClass {}", Style); in TEST_F()
84 Style); in TEST_F()
88 Style); in TEST_F()
92 Style); in TEST_F()
96 Style); in TEST_F()
174 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
176 verifyFormat("var y = A < B ? -1 : 1;", Style); in TEST_F()
180 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
181 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in TEST_F()
189 Style); in TEST_F()
191 verifyFormat("switch (args?.Length) {}", Style); in TEST_F()
198 Style.SpaceBeforeParens = FormatStyle::SBPO_Never; in TEST_F()
200 verifyFormat("switch(args?.Length) {}", Style); in TEST_F()
285 // Modify Style to enforce a column limit. in TEST_F()
286 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
287 Style.ColumnLimit = 10; in TEST_F()
290 Style); in TEST_F()
294 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
295 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in TEST_F()
300 Style); in TEST_F()
304 Style); in TEST_F()
306 Style.SpaceBeforeParens = FormatStyle::SBPO_Never; in TEST_F()
311 Style); in TEST_F()
315 Style); in TEST_F()
317 Style.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements; in TEST_F()
322 Style); in TEST_F()
326 Style); in TEST_F()
328 Style.SpaceBeforeParens = FormatStyle::SBPO_NonEmptyParentheses; in TEST_F()
333 Style); in TEST_F()
337 Style); in TEST_F()
362 FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp); in TEST_F() local
363 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in TEST_F()
369 Style); in TEST_F()
376 Style); in TEST_F()
383 Style); in TEST_F()
389 Style); in TEST_F()
395 Style); in TEST_F()
401 Style); in TEST_F()
410 Style); in TEST_F()
419 Style); in TEST_F()
431 Style); in TEST_F()
435 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
436 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in TEST_F()
438 verifyFormat("List<string> list;", Style); in TEST_F()
439 verifyFormat("Dictionary<string, string> dict;", Style); in TEST_F()
443 Style); in TEST_F()
446 Style); in TEST_F()
447 verifyFormat("switch (x) {}", Style); in TEST_F()
450 Style); in TEST_F()
452 Style.SpaceBeforeParens = FormatStyle::SBPO_Never; in TEST_F()
454 verifyFormat("List<string> list;", Style); in TEST_F()
455 verifyFormat("Dictionary<string, string> dict;", Style); in TEST_F()
459 Style); in TEST_F()
462 Style); in TEST_F()
463 verifyFormat("switch(x) {}", Style); in TEST_F()
466 Style); in TEST_F()
470 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
472 verifyFormat("(int)x / y;", Style); in TEST_F()
474 Style.SpaceAfterCStyleCast = true; in TEST_F()
475 verifyFormat("(int) x / y;", Style); in TEST_F()
479 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
481 verifyFormat(R"(string str = @"""";)", Style); in TEST_F()
482 verifyFormat(R"(string str = @"""Hello world""";)", Style); in TEST_F()
483 verifyFormat(R"(string str = $@"""Hello {friend}""";)", Style); in TEST_F()
487 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
489 verifyFormat(R"(string str1 = $"{null ?? "null"}";)", Style); in TEST_F()
490 verifyFormat(R"(string str2 = $"{{{braceCount} braces";)", Style); in TEST_F()
491 verifyFormat(R"(string str3 = $"{braceCount}}} braces";)", Style); in TEST_F()
495 // Use MS style as Google Style inserts a line break before multiline strings. in TEST_F()
500 FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp); in TEST_F() local
507 EXPECT_EQ(Code, format(Code, Style)); in TEST_F()
517 EXPECT_EQ(Code, format(Code, Style)); in TEST_F()
523 EXPECT_EQ(Code, format(Code, Style)); in TEST_F()
539 // Microsoft Style: in TEST_F()
554 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
570 Style); in TEST_F()
576 Style); in TEST_F()
584 Style); in TEST_F()
593 Style); in TEST_F()
597 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
604 Style); in TEST_F()
608 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
612 Style); in TEST_F()
618 Style); in TEST_F()
620 verifyFormat(R"(foreach (var tickCount in task.Begin(seed: 0)) {)", Style); in TEST_F()
624 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
626 verifyFormat("int Value { get }", Style); in TEST_F()
627 verifyFormat("int Value { get; }", Style); in TEST_F()
628 verifyFormat("int Value { internal get; }", Style); in TEST_F()
629 verifyFormat("int Value { get; } = 0", Style); in TEST_F()
630 verifyFormat("int Value { set }", Style); in TEST_F()
631 verifyFormat("int Value { set; }", Style); in TEST_F()
632 verifyFormat("int Value { internal set; }", Style); in TEST_F()
633 verifyFormat("int Value { set; } = 0", Style); in TEST_F()
634 verifyFormat("int Value { get; set }", Style); in TEST_F()
635 verifyFormat("int Value { set; get }", Style); in TEST_F()
636 verifyFormat("int Value { get; private set; }", Style); in TEST_F()
637 verifyFormat("int Value { get; set; }", Style); in TEST_F()
638 verifyFormat("int Value { get; set; } = 0", Style); in TEST_F()
639 verifyFormat("int Value { internal get; internal set; }", Style); in TEST_F()
647 Style); in TEST_F()
659 Style); in TEST_F()
673 Style); in TEST_F()
680 Style); in TEST_F()
683 Style.ColumnLimit = 100; in TEST_F()
693 Style); in TEST_F()
704 Style); in TEST_F()
707 Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; in TEST_F()
708 Style.BreakBeforeBraces = FormatStyle::BS_Custom; in TEST_F()
709 Style.BraceWrapping.AfterFunction = true; in TEST_F()
723 Style); in TEST_F()
725 // Microsoft style trivial property accessors have no line break before the in TEST_F()
737 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
738 Style.SpaceBeforeSquareBrackets = false; in TEST_F()
739 Style.SpacesInSquareBrackets = false; in TEST_F()
740 Style.SpaceBeforeCpp11BracedList = true; in TEST_F()
741 Style.Cpp11BracedListStyle = false; in TEST_F()
742 Style.SpacesInContainerLiterals = false; in TEST_F()
743 Style.SpaceAfterCStyleCast = false; in TEST_F()
745 verifyFormat(R"(new Car { "Door", 0.1 })", Style); in TEST_F()
746 verifyFormat(R"(new Car { 0.1, "Door" })", Style); in TEST_F()
747 verifyFormat(R"(new string[] { "A" })", Style); in TEST_F()
748 verifyFormat(R"(new string[] {})", Style); in TEST_F()
749 verifyFormat(R"(new Car { someVariableName })", Style); in TEST_F()
750 verifyFormat(R"(new Car { someVariableName })", Style); in TEST_F()
752 Style); in TEST_F()
753 verifyFormat(R"(Apply(x => x.Name, x => () => x.ID);)", Style); in TEST_F()
754 verifyFormat(R"(bool[] xs = { true, true };)", Style); in TEST_F()
755 verifyFormat(R"(taskContext.Factory.Run(async () => doThing(args);)", Style); in TEST_F()
756 verifyFormat(R"(catch (TestException) when (innerFinallyExecuted))", Style); in TEST_F()
757 verifyFormat(R"(private float[,] Values;)", Style); in TEST_F()
758 verifyFormat(R"(Result this[Index x] => Foo(x);)", Style); in TEST_F()
760 verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style); in TEST_F()
761 verifyFormat(R"(var (key, value))", Style); in TEST_F()
764 verifyFormat(R"(A == typeof(X) && someBool)", Style); in TEST_F()
766 // Not seen as a C-style cast. in TEST_F()
770 Style); in TEST_F()
773 verifyFormat("lock (process)", Style); in TEST_F()
775 Style.SpacesInSquareBrackets = true; in TEST_F()
776 verifyFormat(R"(private float[ , ] Values;)", Style); in TEST_F()
777 verifyFormat(R"(string dirPath = args?[ 0 ];)", Style); in TEST_F()
778 verifyFormat(R"(char[ ,, ] rawCharArray = MakeCharacterGrid();)", Style); in TEST_F()
781 verifyFormat(R"(public (string name, int age) methodTuple() {})", Style); in TEST_F()
782 verifyFormat(R"(private (string name, int age) methodTuple() {})", Style); in TEST_F()
783 verifyFormat(R"(protected (string name, int age) methodTuple() {})", Style); in TEST_F()
784 verifyFormat(R"(virtual (string name, int age) methodTuple() {})", Style); in TEST_F()
785 verifyFormat(R"(extern (string name, int age) methodTuple() {})", Style); in TEST_F()
786 verifyFormat(R"(static (string name, int age) methodTuple() {})", Style); in TEST_F()
787 verifyFormat(R"(internal (string name, int age) methodTuple() {})", Style); in TEST_F()
788 verifyFormat(R"(abstract (string name, int age) methodTuple() {})", Style); in TEST_F()
789 verifyFormat(R"(sealed (string name, int age) methodTuple() {})", Style); in TEST_F()
790 verifyFormat(R"(override (string name, int age) methodTuple() {})", Style); in TEST_F()
791 verifyFormat(R"(async (string name, int age) methodTuple() {})", Style); in TEST_F()
792 verifyFormat(R"(unsafe (string name, int age) methodTuple() {})", Style); in TEST_F()
796 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
797 Style.SpacesInSquareBrackets = false; in TEST_F()
805 Style); // int? is nullable not a conditional expression. in TEST_F()
808 Style); // Nullables in function definitions. in TEST_F()
810 verifyFormat(R"(public float? Value;)", Style); // no space before `?`. in TEST_F()
813 Style); // An array of a nullable type. in TEST_F()
815 verifyFormat(R"(var x = (int?)y;)", Style); // Cast to a nullable type. in TEST_F()
817 verifyFormat(R"(var x = new MyContainer<int?>();)", Style); // Generics. in TEST_F()
821 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
827 Style); in TEST_F()
832 Style); in TEST_F()
836 FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); in TEST_F() local
841 Style); in TEST_F()
852 Style); in TEST_F()
857 Style); in TEST_F()
859 Style.ColumnLimit = 50; // Force lines to be wrapped. in TEST_F()
866 Style); in TEST_F()