| Index: packages/dart_style/test/splitting/arguments.stmt
|
| diff --git a/packages/dart_style/test/splitting/arguments.stmt b/packages/dart_style/test/splitting/arguments.stmt
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a292dc097a32fac0aaad5f66c21105b8af85e5f
|
| --- /dev/null
|
| +++ b/packages/dart_style/test/splitting/arguments.stmt
|
| @@ -0,0 +1,197 @@
|
| +40 columns |
|
| +>>> many arguments
|
| +method(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth,
|
| + tenth, eleventh, twelfth);
|
| +<<<
|
| +method(
|
| + first,
|
| + second,
|
| + third,
|
| + fourth,
|
| + fifth,
|
| + sixth,
|
| + seventh,
|
| + eighth,
|
| + ninth,
|
| + tenth,
|
| + eleventh,
|
| + twelfth);
|
| +>>> wrap before first argument
|
| +longFunctionIsLoooooooooooooong(argument, argument);
|
| +<<<
|
| +longFunctionIsLoooooooooooooong(
|
| + argument, argument);
|
| +>>> wrap with just one argument
|
| +print('a very very long string literal');
|
| +<<<<
|
| +print(
|
| + 'a very very long string literal');
|
| +>>>
|
| +printNumbers(000000000000000000000, 111);
|
| +<<<
|
| +printNumbers(
|
| + 000000000000000000000, 111);
|
| +>>>
|
| +function(firstArg * second, third * fourthAndLongest);
|
| +<<<
|
| +function(firstArg * second,
|
| + third * fourthAndLongest);
|
| +>>> arguments, nested
|
| +someFunctionOne(someArgument,
|
| +someFunctionTwo(argument, argument, argument),
|
| +someFunctionTwo(argument, argument, argument),
|
| +someArgument, someArgument);
|
| +<<<
|
| +someFunctionOne(
|
| + someArgument,
|
| + someFunctionTwo(
|
| + argument, argument, argument),
|
| + someFunctionTwo(
|
| + argument, argument, argument),
|
| + someArgument,
|
| + someArgument);
|
| +>>> force all arguments to split if an argument splits
|
| +foo(a, b, inner(veryLongArgument, veryLongArgument), c);
|
| +<<<
|
| +foo(
|
| + a,
|
| + b,
|
| + inner(veryLongArgument,
|
| + veryLongArgument),
|
| + c);
|
| +>>> do not force single-argument list to split if argument splits
|
| +foo(inner(veryLongArgument, veryLongArgument));
|
| +<<<
|
| +foo(inner(veryLongArgument,
|
| + veryLongArgument));
|
| +>>> do not split empty argument list
|
| +foo___________________________________();
|
| +<<<
|
| +foo___________________________________();
|
| +>>> do split empty argument list if it contains a comment
|
| +foo___________________________________(/* */);
|
| +<<<
|
| +foo___________________________________(
|
| + /* */);
|
| +>>> keep positional and named on first line
|
| +foo(arg, arg, foo: 1, bar: 2);
|
| +<<<
|
| +foo(arg, arg, foo: 1, bar: 2);
|
| +>>> move just named to second line even though all fit on second
|
| +reallyLongMethod(
|
| + argument, foo: first, bar: second);
|
| +<<<
|
| +reallyLongMethod(argument,
|
| + foo: first, bar: second);
|
| +>>> split named and keep positional on first
|
| +reallyLongMethod(argument, argument, foo: first, bar: second, baz: third);
|
| +<<<
|
| +reallyLongMethod(argument, argument,
|
| + foo: first,
|
| + bar: second,
|
| + baz: third);
|
| +>>> only named arguments and move to second line
|
| +reallyLongMethod(foo: first, bar: second, ba: third);
|
| +<<<
|
| +reallyLongMethod(
|
| + foo: first, bar: second, ba: third);
|
| +>>> only named arguments and split
|
| +reallyLongMethod(foo: first, bar: second, baz: third);
|
| +<<<
|
| +reallyLongMethod(
|
| + foo: first,
|
| + bar: second,
|
| + baz: third);
|
| +>>> if split before first positional, split before first named too
|
| +reallyLongMethodName(
|
| + first, second, third, a: 1, b: 1);
|
| +<<<
|
| +reallyLongMethodName(
|
| + first, second, third,
|
| + a: 1, b: 1);
|
| +>>> if split before other positional, split before first named too
|
| +reallyLongMethodName(first, second,
|
| + third, fourth, fif, s, a: 1, b: 1);
|
| +<<<
|
| +reallyLongMethodName(first, second,
|
| + third, fourth, fif, s,
|
| + a: 1, b: 1);
|
| +>>> if positional args go one per line, named do too
|
| +reallyLongMethod(first, second, third, fourth, fifth, sixth, seventh, eighth, a: 1, b: 2);
|
| +<<<
|
| +reallyLongMethod(
|
| + first,
|
| + second,
|
| + third,
|
| + fourth,
|
| + fifth,
|
| + sixth,
|
| + seventh,
|
| + eighth,
|
| + a: 1,
|
| + b: 2);
|
| +>>> avoid splitting before single positional argument
|
| +someLongReceiver.veryLongMethod(argument);
|
| +<<<
|
| +someLongReceiver
|
| + .veryLongMethod(argument);
|
| +>>> multiple nested collections
|
| +method(function([veryLongElement, veryLongElement], [veryLongElement, veryLongElement]), argument);
|
| +<<<
|
| +method(
|
| + function([
|
| + veryLongElement,
|
| + veryLongElement
|
| + ], [
|
| + veryLongElement,
|
| + veryLongElement
|
| + ]),
|
| + argument);
|
| +>>> trailing collections are not indented
|
| +function(argument, argument, argument, argument,
|
| +[element, element, element, element],
|
| +{'key': value, 'other key': value, 'third key': value});
|
| +<<<
|
| +function(argument, argument, argument,
|
| + argument, [
|
| + element,
|
| + element,
|
| + element,
|
| + element
|
| +], {
|
| + 'key': value,
|
| + 'other key': value,
|
| + 'third key': value
|
| +});
|
| +>>> all trailing collections
|
| +function([element, element, element, element], {'key': value, 'other key': value, 'third key': value});
|
| +<<<
|
| +function([
|
| + element,
|
| + element,
|
| + element,
|
| + element
|
| +], {
|
| + 'key': value,
|
| + 'other key': value,
|
| + 'third key': value
|
| +});
|
| +>>> non-collection non-preceding argument forces all collections to indent
|
| +function([element, element, element, element], argument,
|
| +{'key': value, 'other key': value, 'third key': value}, () {;});
|
| +<<<
|
| +function(
|
| + [
|
| + element,
|
| + element,
|
| + element,
|
| + element
|
| + ],
|
| + argument,
|
| + {
|
| + 'key': value,
|
| + 'other key': value,
|
| + 'third key': value
|
| + }, () {
|
| + ;
|
| +});
|
|
|