Index: packages/dart_style/test/splitting/function_arguments.stmt |
diff --git a/packages/dart_style/test/splitting/function_arguments.stmt b/packages/dart_style/test/splitting/function_arguments.stmt |
new file mode 100644 |
index 0000000000000000000000000000000000000000..89c09563b54703a651804d73f69d70fd29db60a6 |
--- /dev/null |
+++ b/packages/dart_style/test/splitting/function_arguments.stmt |
@@ -0,0 +1,181 @@ |
+40 columns | |
+>>> args before and after function do not force nesting |
+method(first,() {fn;},third); |
+<<< |
+method(first, () { |
+ fn; |
+}, third); |
+>>> nothing but function args does not nest |
+longFunctionName(() {;}, () {;}, () {;}); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> trailing functions do not nest |
+longFunctionName(argument, argument, argument, argument, () {;}, () {;}); |
+<<< |
+longFunctionName(argument, argument, |
+ argument, argument, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> leading functions do not nest |
+longFunctionName(() {;}, () {;}, argument, argument, argument, argument); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+}, argument, argument, argument, |
+ argument); |
+>>> arg between functions forces nesting |
+longFunctionName(() {;}, argument, () {;}); |
+<<< |
+longFunctionName( |
+ () { |
+ ; |
+ }, |
+ argument, |
+ () { |
+ ; |
+ }); |
+>>> unsplit leading args |
+longFunctionName(arg, arg, () {;}, () {;}); |
+<<< |
+longFunctionName(arg, arg, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> split before leading args |
+longFunctionName(argument, argument, argument, () {;}, () {;}); |
+<<< |
+longFunctionName( |
+ argument, argument, argument, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> split in middle of leading args |
+longFunctionName(argument, argument, argument, argument, () {;}, () {;}); |
+<<< |
+longFunctionName(argument, argument, |
+ argument, argument, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> split before all leading args |
+longFunctionName(argument, argument, argument, argument, argument, argument, |
+() {;}, () {;}); |
+<<< |
+longFunctionName( |
+ argument, |
+ argument, |
+ argument, |
+ argument, |
+ argument, |
+ argument, () { |
+ ; |
+}, () { |
+ ; |
+}); |
+>>> unsplit trailing args |
+longFunctionName(() {;}, () {;}, argument, argument); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+}, argument, argument); |
+>>> split before trailing args |
+longFunctionName(() {;}, () {;} /* very very long comment */, argument, argument); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+} /* very very long comment */, |
+ argument, argument); |
+>>> split in middle of trailing args |
+longFunctionName(() {;}, () {;}, argument, argument, argument, argument); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+}, argument, argument, argument, |
+ argument); |
+>>> split before all trailing args |
+longFunctionName(() {;}, () {;}, argument, argument, argument, argument, |
+argument, argument, argument); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, () { |
+ ; |
+}, |
+ argument, |
+ argument, |
+ argument, |
+ argument, |
+ argument, |
+ argument, |
+ argument); |
+>>> functions with named arguments |
+longFunctionName(() {;}, a: () {;}, b: () {;}); |
+<<< |
+longFunctionName(() { |
+ ; |
+}, a: () { |
+ ; |
+}, b: () { |
+ ; |
+}); |
+>>> do not nest because of nested 1-arg fn |
+outer(inner(() {body;})); |
+<<< |
+outer(inner(() { |
+ body; |
+})); |
+>>> do not nest because of nested many-arg fn |
+outer(argument, inner(() {body;})); |
+<<< |
+outer(argument, inner(() { |
+ body; |
+})); |
+>>> do not nest because of nested 1-arg method call |
+obj.outer(a.b.c.fn(() {body;})); |
+<<< |
+obj.outer(a.b.c.fn(() { |
+ body; |
+})); |
+>>> do not nest because of nested many-arg method call |
+obj.outer(argument, a.b.c.fn(() {body;})); |
+<<< |
+obj.outer(argument, a.b.c.fn(() { |
+ body; |
+})); |
+>>> do not force named args to split on positional function |
+function(argument, () {;}, |
+ named: argument, another: argument); |
+<<< |
+function(argument, () { |
+ ; |
+}, named: argument, another: argument); |
+>>> args before and after functions split independently |
+longFunction(argument, argument, argument, argument, argument, |
+() {;}, () {;}, argument, argument, argument, argument, argument); |
+<<< |
+longFunction(argument, argument, |
+ argument, argument, argument, () { |
+ ; |
+}, () { |
+ ; |
+}, argument, argument, argument, |
+ argument, argument); |