Index: packages/dart_style/test/splitting/expressions.stmt |
diff --git a/packages/dart_style/test/splitting/expressions.stmt b/packages/dart_style/test/splitting/expressions.stmt |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ac19efd6d6893ee612408a0916b6a7edff91a98 |
--- /dev/null |
+++ b/packages/dart_style/test/splitting/expressions.stmt |
@@ -0,0 +1,136 @@ |
+40 columns | |
+>>> space-separated adjacent strings are not split if they fit |
+var name = new Symbol("the first string" "the second"); |
+<<< |
+var name = new Symbol( |
+ "the first string" "the second"); |
+>>> space-separated adjacent strings are split if they don't fit |
+var name = new Symbol("the first very long string" "the second very longstring"); |
+<<< |
+var name = new Symbol( |
+ "the first very long string" |
+ "the second very longstring"); |
+>>> adjacent string lines all split together; |
+var text = "first" "second" "third" "fourth" "fifth"; |
+<<< |
+var text = "first" |
+ "second" |
+ "third" |
+ "fourth" |
+ "fifth"; |
+>>> preserve one newline between adjacent strings |
+var name = "the first string" |
+"the second string" |
+ |
+ |
+ |
+"the third string"; |
+<<< |
+var name = "the first string" |
+ "the second string" |
+ "the third string"; |
+>>> conditions, same operator |
+if (identifier || identifier || identifier || identifier) { |
+} |
+<<< |
+if (identifier || |
+ identifier || |
+ identifier || |
+ identifier) {} |
+>>> conditions, different operators |
+if (identifier && identifier || identifier |
+ && identifier) { |
+} |
+<<< |
+if (identifier && identifier || |
+ identifier && identifier) {} |
+>>> split conditional because then doesn't fit |
+var kind = element != null ? longArgument : arg; |
+<<< |
+var kind = element != null |
+ ? longArgument |
+ : arg; |
+>>> split conditional because else doesn't fit |
+var kind = element != null ? argument : secondArgumentThatIsReallyLong; |
+<<< |
+var kind = element != null |
+ ? argument |
+ : secondArgumentThatIsReallyLong; |
+>>> split operator chain around block |
+first + second + () {body;} + third + fourth; |
+<<< |
+first + |
+ second + |
+ () { |
+ body; |
+ } + |
+ third + |
+ fourth; |
+>>> indent previous line farther because later line is nested deeper |
+someFunction(someExtremelyLongArgumentName).clamp(); |
+<<< |
+someFunction( |
+ someExtremelyLongArgumentName) |
+ .clamp(); |
+>>> wrap inside parenthesized |
+(someVerylongIdentifier * someVerylongIdentifier); |
+<<< |
+(someVerylongIdentifier * |
+ someVerylongIdentifier); |
+>>> same operator inside parenthesized is treated independently |
+(identifier * (identifier * identifier) * identifier); |
+<<< |
+(identifier * |
+ (identifier * identifier) * |
+ identifier); |
+>>> nested parenthesized are indented more |
+(identifier * (verylongIdentifier * verylongIdentifier) * identifier); |
+<<< |
+(identifier * |
+ (verylongIdentifier * |
+ verylongIdentifier) * |
+ identifier); |
+>>> conditional operands are nested |
+identifier ? identifier ? someParticularlyLongOperand : someParticularlyLongOperand : identifier ? someParticularlyLongOperand : someParticularlyLongOperand; |
+<<< |
+identifier |
+ ? identifier |
+ ? someParticularlyLongOperand |
+ : someParticularlyLongOperand |
+ : identifier |
+ ? someParticularlyLongOperand |
+ : someParticularlyLongOperand; |
+>>> index expressions can split after "[" |
+verylongIdentifier[someParticularlyLongArgument]; |
+<<< |
+verylongIdentifier[ |
+ someParticularlyLongArgument]; |
+>>> index arguments nest |
+verylongIdentifier[someParticularlyLongArgument[someParticularlyLongArgument]]; |
+<<< |
+verylongIdentifier[ |
+ someParticularlyLongArgument[ |
+ someParticularlyLongArgument]]; |
+>>> successive index arguments |
+identifier[longArgument][longArgument][longArgument][longArgument][longArgument]; |
+<<< |
+identifier[longArgument][longArgument] |
+ [longArgument][longArgument] |
+ [longArgument]; |
+>>> is |
+verylongIdentifier.property is LongTypeName; |
+<<< |
+verylongIdentifier.property |
+ is LongTypeName; |
+>>> as |
+verylongIdentifier.property as LongTypeName; |
+<<< |
+verylongIdentifier.property |
+ as LongTypeName; |
+>>> null coalescing operator |
+identifier&&identifier&&identifier&&identifier; |
+<<< |
+identifier && |
+ identifier && |
+ identifier && |
+ identifier; |