blob: 53d07d8114fe59e8c3221671acd07660e7236b42 [file] [log] [blame]
40 columns |
### Test how multiple block argument candidates are handled.
>>> Multiple function expressions prevent block formatting.
function(() { one; }, () { two; });
<<<
function(
() {
one;
},
() {
two;
},
);
>>> Empty and non-empty function expressions.
function(() {}, () { body; }, () {});
<<<
function(() {}, () {
body;
}, () {});
>>> Function expression takes precedence over other kinds of block arguments.
### The function is block formatted but the other arguments aren't.
function([1, 2], () { body; }, {3, 4});
<<<
function([1, 2], () {
body;
}, {3, 4});
>>> Immediately invoked function takes precedence over other kinds of block arguments.
function([1, 2], () { body; }(), {3, 4});
<<<
function([1, 2], () {
body;
}(), {3, 4});
>>> Multiple collections prevent block formatting.
function([element, element], {key: value});
<<<
function(
[element, element],
{key: value},
);
>>> Empty and non-empty collections.
function([], [element, element], <String>{});
<<<
function([], [
element,
element,
], <String>{});
>>> Can't block format a function call with any preceding arguments.
function(arg, innerFunction(veryLongArgumentExpression));
<<<
function(
arg,
innerFunction(
veryLongArgumentExpression,
),
);
>>> Can't block format a function call with any subsequent arguments.
function(innerFunction(veryLongArgumentExpression), arg);
<<<
function(
innerFunction(
veryLongArgumentExpression,
),
arg,
);
>>> Can't block format a method call with any preceding arguments.
function(arg, target.inner(veryLongArgumentExpression));
<<<
function(
arg,
target.inner(
veryLongArgumentExpression,
),
);
>>> Can't block format a method call with any subsequent arguments.
function(target.inner(veryLongArgumentExpression), arg);
<<<
function(
target.inner(
veryLongArgumentExpression,
),
arg,
);
>>> Can't block format an instance creation with any preceding arguments.
function(arg, new SomeClass(veryLongArgumentExpression));
<<<
function(
arg,
new SomeClass(
veryLongArgumentExpression,
),
);
>>> Can't block format an instance creation with any subsequent arguments.
function(new SomeClass(veryLongArgumentExpression), arg);
<<<
function(
new SomeClass(
veryLongArgumentExpression,
),
arg,
);
>>> List literal with other non-block arguments.
function(before, [veryLongElement, anotherLongElement], after);
<<<
function(before, [
veryLongElement,
anotherLongElement,
], after);
>>> Map literal with other non-block arguments.
function(before, {1: veryLongElement, 2: anotherLongElement}, after);
<<<
function(before, {
1: veryLongElement,
2: anotherLongElement,
}, after);
>>> Set literal with other non-block arguments.
function(before, {veryLongElement, anotherLongElement}, after);
<<<
function(before, {
veryLongElement,
anotherLongElement,
}, after);
>>> Record literal with other non-block arguments.
function(before, (veryLongElement, anotherLongElement), after);
<<<
function(before, (
veryLongElement,
anotherLongElement,
), after);
>>> Switch expression with other non-block arguments.
function(before, switch (n) {1 => veryLongElement, 2 => anotherLongElement}, after);
<<<
function(before, switch (n) {
1 => veryLongElement,
2 => anotherLongElement,
}, after);
>>> Multiple switches prevent block formatting.
function(switch (a) { 1 => 2 }, switch (b) { 1 => 2 });
<<<
function(
switch (a) {
1 => 2,
},
switch (b) {
1 => 2,
},
);
>>> Empty and non-empty switches.
function(switch (a) {}, switch (b) { 1 => 2 }, switch (c) {});
<<<
function(switch (a) {}, switch (b) {
1 => 2,
}, switch (c) {});
>>> Collection and multiline string prevents block formatting.
function([element, element], '''multiple
lines''');
<<<
function(
[element, element],
'''multiple
lines''',
);