Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1153)

Unified Diff: test/whitespace/functions.unit

Issue 2196863002: Format parameter lists with trailing commas like argument lists. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/src/source_visitor.dart ('K') | « test/comments/functions.unit ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/whitespace/functions.unit
diff --git a/test/whitespace/functions.unit b/test/whitespace/functions.unit
index 2e8f4871f2f19f213f0275b22b19dad34bd30e77..206ec2b47fac88a21642fea5a426035e9343b64f 100644
--- a/test/whitespace/functions.unit
+++ b/test/whitespace/functions.unit
@@ -77,10 +77,88 @@ main() sync* {
var lambda = () sync* {};
}
>>> trailing comma in single parameter list
-function(argument , ) {}
+function(parameter , ) {;}
<<<
-function(argument,) {}
+function(
+ parameter,
+) {
+ ;
+}
>>> trailing comma in parameter list
-function(argument,argument , ) {}
+function(parameter,parameter , ) {;}
+<<<
+function(
+ parameter,
+ parameter,
+) {
+ ;
+}
+>>> trailing comma in all optional parameter list
+function([parameter,parameter , ]) {;}
+<<<
+function([
+ parameter,
+ parameter,
+]) {
+ ;
+}
+>>> trailing comma in all named parameter list
+function({parameter,parameter , }) {;}
+<<<
+function({
+ parameter,
+ parameter,
+}) {
+ ;
+}
+>>> trailing comma in mixed optional parameter list
+function(parameter,[parameter,parameter , ]) {;}
<<<
-function(argument, argument,) {}
+function(
+ parameter, [
+ parameter,
+ parameter,
+]) {
+ ;
+}
+>>> trailing comma in mixed named parameter list
+function(parameter,{parameter,parameter , }) {;}
+<<<
+function(
+ parameter, {
+ parameter,
+ parameter,
+}) {
+ ;
+}
+>>> trailing comma with => function containing split
+function(parameter,parameter,) => veryLongBodyThatWraps(argument, argument, argument, argument);
+<<<
+function(
+ parameter,
+ parameter,
+) =>
+ veryLongBodyThatWraps(argument,
+ argument, argument, argument);
+>>> trailing comma with wrap at =>
+function(parameter,parameter,) /* comment */ => "a very very long string";
+<<<
+function(
+ parameter,
+ parameter,
+) /* comment */ =>
+ "a very very long string";
+>>> trailing comma function nested in expression
+main() {
+ someVeryLongFunction(argument, argument, (parameter, parameter,) {;});
+}
+<<< (this looks weird, but it should rare and at least we test it)
+main() {
+ someVeryLongFunction(
+ argument, argument, (
+ parameter,
+ parameter,
+ ) {
+ ;
+ });
+}
« lib/src/source_visitor.dart ('K') | « test/comments/functions.unit ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698