Index: packages/dart_style/test/splitting/lists.stmt |
diff --git a/packages/dart_style/test/splitting/lists.stmt b/packages/dart_style/test/splitting/lists.stmt |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e92600f54b35438e2deadeef60da634d006f7547 |
--- /dev/null |
+++ b/packages/dart_style/test/splitting/lists.stmt |
@@ -0,0 +1,168 @@ |
+40 columns | |
+>>> empty list |
+[]; |
+<<< |
+[]; |
+>>> exactly 40 characters |
+[first, second, third, fourth, seventh]; |
+<<< |
+[first, second, third, fourth, seventh]; |
+>>> |
+[first, second, third, fourth, fifth, sixth]; |
+<<< |
+[ |
+ first, |
+ second, |
+ third, |
+ fourth, |
+ fifth, |
+ sixth |
+]; |
+>>> splits outer lists even if they fit |
+[[first], [], [ |
+ second,[third], fourth] ]; |
+<<< |
+[ |
+ [first], |
+ [], |
+ [ |
+ second, |
+ [third], |
+ fourth |
+ ] |
+]; |
+>>> split indirect outer |
+[function([inner])]; |
+<<< |
+[ |
+ function([inner]) |
+]; |
+>>> empty literal does not force outer split |
+[[], {}, () {}]; |
+<<< |
+[[], {}, () {}]; |
+>>> nested split list |
+[first, [second, third, fourth], fifth, [sixth, seventh, eighth, nine, tenth, |
+ eleventh]]; |
+<<< |
+[ |
+ first, |
+ [second, third, fourth], |
+ fifth, |
+ [ |
+ sixth, |
+ seventh, |
+ eighth, |
+ nine, |
+ tenth, |
+ eleventh |
+ ] |
+]; |
+>>> force multi-line because of contained block |
+[first, () {"fn";},third,fourth]; |
+<<< |
+[ |
+ first, |
+ () { |
+ "fn"; |
+ }, |
+ third, |
+ fourth |
+]; |
+>>> spaces between items |
+[1,2,3,4]; |
+<<< |
+[1, 2, 3, 4]; |
+>>> dangling comma |
+[1 , ]; |
+<<< |
+[1,]; |
+>>> dangling comma multiline |
+[first, second, third, fourth, fifth, sixth , ]; |
+<<< |
+[ |
+ first, |
+ second, |
+ third, |
+ fourth, |
+ fifth, |
+ sixth, |
+]; |
+>>> nested lists are forced to split |
+[[[[[argument, argument, argument, argument]]]]]; |
+<<< |
+[ |
+ [ |
+ [ |
+ [ |
+ [ |
+ argument, |
+ argument, |
+ argument, |
+ argument |
+ ] |
+ ] |
+ ] |
+ ] |
+]; |
+>>> preserve newlines in lists containing a line comment |
+[ |
+ // yeah |
+ a,b,c, |
+ d,e,f, |
+]; |
+<<< |
+[ |
+ // yeah |
+ a, b, c, |
+ d, e, f, |
+]; |
+>>> wrap between elements even when newlines are preserved |
+[ |
+ // yes |
+ longElement,longElement,longElement,longElement, |
+ longElement,longElement,longElement,longElement,longElement,longElement, |
+]; |
+<<< |
+[ |
+ // yes |
+ longElement, longElement, longElement, |
+ longElement, |
+ longElement, longElement, longElement, |
+ longElement, longElement, longElement, |
+]; |
+>>> ignore line comment after the "]" |
+[ |
+ a,b,c, |
+ d |
+] // comment |
+; |
+<<< |
+[a, b, c, d] // comment |
+ ; |
+>>> preserves one blank line between elements |
+[ |
+ |
+ |
+ element, |
+ |
+ |
+ |
+ // comment |
+ element, |
+ |
+ |
+ |
+ element |
+ |
+ |
+]; |
+<<< |
+[ |
+ element, |
+ |
+ // comment |
+ element, |
+ |
+ element |
+]; |