@@ -22,10 +22,10 @@ public static IEnumerable<object[]> GetTestDeclarations(string delimiter)
2222
2323 public static IEnumerable < object [ ] > GetMultilineTestDeclarations ( string delimiter )
2424 {
25- yield return new object [ ] { $ "public Foo(int a,{ delimiter } {{|#0: string\r \n s|}} ) {{ }}" } ;
26- yield return new object [ ] { $ "public object Bar(int a,{ delimiter } {{|#0: string\r \n s|}} ) => null;" } ;
27- yield return new object [ ] { $ "public object this[int a,{ delimiter } {{|#0: string\r \n s|}} ] => null;" } ;
28- yield return new object [ ] { $ "public delegate void Bar(int a,{ delimiter } {{|#0: string\r \n s|}} );" } ;
25+ yield return new object [ ] { $ "public Foo(int a,{ delimiter } string\r \n s) {{ }}" } ;
26+ yield return new object [ ] { $ "public object Bar(int a,{ delimiter } string\r \n s) => null;" } ;
27+ yield return new object [ ] { $ "public object this[int a,{ delimiter } string\r \n s] => null;" } ;
28+ yield return new object [ ] { $ "public delegate void Bar(int a,{ delimiter } string\r \n s);" } ;
2929 }
3030
3131 public static IEnumerable < object [ ] > GetTestConstructorInitializers ( string delimiter )
@@ -52,16 +52,20 @@ public static IEnumerable<object[]> GetTestExpressions(string delimiter)
5252 yield return new object [ ] { $ "long ll = this[2, 2,{ delimiter } {{|#0:2|}}];" } ;
5353 }
5454
55- public static IEnumerable < object [ ] > GetMultilineTestExpressions ( string delimiter )
55+ public static IEnumerable < object [ ] > GetTrailingMultilineTestExpressions ( string delimiter )
56+ {
57+ yield return new object [ ] { $ "System.Action<int, int, int> func = (int x, { delimiter } int y, { delimiter } int\r \n z) => Bar(x, y, z)" } ;
58+ yield return new object [ ] { $ "System.Action<int, int, int> func = delegate(int x, { delimiter } int y, { delimiter } int\r \n z) {{ Bar(x, y, z); }}" } ;
59+ yield return new object [ ] { $ "var arr = new string[2, { delimiter } 2\r \n + 2];" } ;
60+ yield return new object [ ] { $ "char cc = (new char[3, 3])[2, { delimiter } 2\r \n + 2];" } ;
61+ yield return new object [ ] { $ "char? c = (new char[3, 3])?[2, { delimiter } 2\r \n + 2];" } ;
62+ yield return new object [ ] { $ "long ll = this[2,{ delimiter } 2,{ delimiter } 2\r \n + 1];" } ;
63+ yield return new object [ ] { $ "var str = string.Join(\r \n \" def\" ,{ delimiter } \" abc\" \r \n + \" cba\" );" } ;
64+ }
65+
66+ public static IEnumerable < object [ ] > GetLeadingMultilineTestExpressions ( string delimiter )
5667 {
57- yield return new object [ ] { $ "System.Action<int, int, int> func = (int x, { delimiter } int y, { delimiter } {{|#0:int\r \n z|}}) => Bar(x, y, z)" } ;
58- yield return new object [ ] { $ "System.Action<int, int, int> func = delegate(int x, { delimiter } int y, { delimiter } {{|#0:int\r \n z|}}) {{ Bar(x, y, z); }}" } ;
59- yield return new object [ ] { $ "var arr = new string[2, { delimiter } {{|#0:2\r \n + 2|}}];" } ;
60- yield return new object [ ] { $ "char cc = (new char[3, 3])[2, { delimiter } {{|#0:2\r \n + 2|}}];" } ;
61- yield return new object [ ] { $ "char? c = (new char[3, 3])?[2, { delimiter } {{|#0:2\r \n + 2|}}];" } ;
62- yield return new object [ ] { $ "long ll = this[2,{ delimiter } 2,{ delimiter } {{|#0:2\r \n + 1|}}];" } ;
6368 yield return new object [ ] { $ "var str = string.Join(\r \n \" abc\" \r \n + \" cba\" ,{ delimiter } {{|#0:\" def\" |}});" } ;
64- yield return new object [ ] { $ "var str = string.Join(\r \n \" def\" ,{ delimiter } {{|#0:\" abc\" \r \n + \" cba\" |}});" } ;
6569 yield return new object [ ] { $ "Bar(\r \n 1\r \n + 2,{ delimiter } {{|#0:3|}},\r \n 4);" } ;
6670 }
6771
@@ -72,7 +76,7 @@ public static IEnumerable<object[]> GetTestAttributes(string delimiter)
7276
7377 public static IEnumerable < object [ ] > GetMultilineTestAttributes ( string delimiter )
7478 {
75- yield return new object [ ] { $ "[MyAttribute(1, { delimiter } 2, { delimiter } {{|#0: 3\r \n + 5|}} )]" } ;
79+ yield return new object [ ] { $ "[MyAttribute(1, { delimiter } 2, { delimiter } 3\r \n + 5)]" } ;
7680 }
7781
7882 public static IEnumerable < object [ ] > ValidTestExpressions ( )
@@ -120,6 +124,7 @@ public static IEnumerable<object[]> ValidTestAttribute()
120124 [ Theory ]
121125 [ MemberData ( nameof ( GetTestDeclarations ) , "" ) ]
122126 [ MemberData ( nameof ( GetMultilineTestDeclarations ) , "\r \n " ) ]
127+ [ MemberData ( nameof ( GetMultilineTestDeclarations ) , "" ) ]
123128 [ MemberData ( nameof ( ValidTestDeclarations ) ) ]
124129 public async Task TestValidDeclarationAsync ( string declaration )
125130 {
@@ -133,7 +138,6 @@ class Foo
133138
134139 [ Theory ]
135140 [ MemberData ( nameof ( GetTestDeclarations ) , "\r \n " ) ]
136- [ MemberData ( nameof ( GetMultilineTestDeclarations ) , "" ) ]
137141 public async Task TestInvalidDeclarationAsync ( string declaration )
138142 {
139143 var testCode = $@ "
@@ -207,7 +211,9 @@ public Derived(int i, int j, string z)
207211
208212 [ Theory ]
209213 [ MemberData ( nameof ( GetTestExpressions ) , "" ) ]
210- [ MemberData ( nameof ( GetMultilineTestExpressions ) , "\r \n " ) ]
214+ [ MemberData ( nameof ( GetLeadingMultilineTestExpressions ) , "\r \n " ) ]
215+ [ MemberData ( nameof ( GetTrailingMultilineTestExpressions ) , "\r \n " ) ]
216+ [ MemberData ( nameof ( GetTrailingMultilineTestExpressions ) , "" ) ]
211217 [ MemberData ( nameof ( ValidTestExpressions ) ) ]
212218 public async Task TestValidExpressionAsync ( string expression )
213219 {
@@ -231,7 +237,7 @@ public void Baz()
231237
232238 [ Theory ]
233239 [ MemberData ( nameof ( GetTestExpressions ) , "\r \n " ) ]
234- [ MemberData ( nameof ( GetMultilineTestExpressions ) , "" ) ]
240+ [ MemberData ( nameof ( GetLeadingMultilineTestExpressions ) , "" ) ]
235241 public async Task TestInvalidExpressionAsync ( string expression )
236242 {
237243 var testCode = $@ "
@@ -256,6 +262,7 @@ public void Baz()
256262 [ Theory ]
257263 [ MemberData ( nameof ( GetTestAttributes ) , "" ) ]
258264 [ MemberData ( nameof ( GetMultilineTestAttributes ) , "\r \n " ) ]
265+ [ MemberData ( nameof ( GetMultilineTestAttributes ) , "" ) ]
259266 [ MemberData ( nameof ( ValidTestAttribute ) ) ]
260267 public async Task TestValidAttributeAsync ( string attribute )
261268 {
@@ -278,7 +285,6 @@ class Foo
278285
279286 [ Theory ]
280287 [ MemberData ( nameof ( GetTestAttributes ) , "\r \n " ) ]
281- [ MemberData ( nameof ( GetMultilineTestAttributes ) , "" ) ]
282288 public async Task TestInvalidAttributeAsync ( string attribute )
283289 {
284290 var testCode = $@ "
0 commit comments