@@ -41,7 +41,7 @@ private C() { }
4141 var expected = this . CSharpDiagnostic ( DeclarePublicAPIAnalyzer . DeclareNewApiRule ) . WithArguments ( "C" ) . WithLocation ( 2 , 14 ) ;
4242 await this . VerifyCSharpDiagnosticAsync ( source , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
4343
44- string fixedApi = "C" ;
44+ string fixedApi = "C" + Environment . NewLine ;
4545 var updatedApi = await this . GetUpdatedApiAsync ( source , 0 , CancellationToken . None ) . ConfigureAwait ( false ) ;
4646
4747 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
@@ -89,27 +89,27 @@ public void Method() { }
8989
9090 await this . VerifyCSharpDiagnosticAsync ( source , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
9191
92- string fixedApi = "C" ;
92+ string fixedApi = "C" + Environment . NewLine ;
9393 var updatedApi = await this . GetUpdatedApiAsync ( source , 0 , CancellationToken . None ) . ConfigureAwait ( false ) ;
9494 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
9595
96- fixedApi = "C.C() -> void" ;
96+ fixedApi = "C.C() -> void" + Environment . NewLine ;
9797 updatedApi = await this . GetUpdatedApiAsync ( source , 1 , CancellationToken . None ) . ConfigureAwait ( false ) ;
9898 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
9999
100- fixedApi = "C.Field -> int" ;
100+ fixedApi = "C.Field -> int" + Environment . NewLine ;
101101 updatedApi = await this . GetUpdatedApiAsync ( source , 2 , CancellationToken . None ) . ConfigureAwait ( false ) ;
102102 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
103103
104- fixedApi = "C.Property.get -> int" ;
104+ fixedApi = "C.Property.get -> int" + Environment . NewLine ;
105105 updatedApi = await this . GetUpdatedApiAsync ( source , 3 , CancellationToken . None ) . ConfigureAwait ( false ) ;
106106 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
107107
108- fixedApi = "C.Property.set -> void" ;
108+ fixedApi = "C.Property.set -> void" + Environment . NewLine ;
109109 updatedApi = await this . GetUpdatedApiAsync ( source , 4 , CancellationToken . None ) . ConfigureAwait ( false ) ;
110110 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
111111
112- fixedApi = "C.Method() -> void" ;
112+ fixedApi = "C.Method() -> void" + Environment . NewLine ;
113113 updatedApi = await this . GetUpdatedApiAsync ( source , 5 , CancellationToken . None ) . ConfigureAwait ( false ) ;
114114 Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
115115 }
@@ -730,7 +730,8 @@ private C() { }
730730
731731 this . shippedText = string . Empty ;
732732 this . unshippedText = string . Empty ;
733- var fixedUnshippedText = @"C" ;
733+ var fixedUnshippedText = @"C
734+ " ;
734735
735736 await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
736737 }
@@ -752,7 +753,8 @@ public class C2 { }
752753 var fixedUnshippedText = @"C
753754C.Field -> int
754755C2
755- C2.C2() -> void" ;
756+ C2.C2() -> void
757+ " ;
756758
757759 await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
758760 }
@@ -848,7 +850,8 @@ public class C2 { }
848850C.CC.Field -> int
849851C.Field -> int
850852C2
851- C2.C2() -> void" ;
853+ C2.C2() -> void
854+ " ;
852855
853856 await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
854857 }
@@ -993,7 +996,8 @@ public class C2 { }
993996 var fixedUnshippedText = @"C
994997C.Field -> int
995998C2
996- C2.C2() -> void" ;
999+ C2.C2() -> void
1000+ " ;
9971001
9981002 await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
9991003 }
@@ -1030,6 +1034,24 @@ public class C2 { }
10301034 await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , numberOfFixAllIterations : 2 , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
10311035 }
10321036
1037+ [ Fact ]
1038+ public async Task TestAddTrailingNewlineByDefaultAsync ( )
1039+ {
1040+ var source = @"
1041+ public class C
1042+ {
1043+ }
1044+ " ;
1045+
1046+ this . shippedText = string . Empty ;
1047+ this . unshippedText = string . Empty ;
1048+ var fixedUnshippedText = @"C
1049+ C.C() -> void
1050+ " ;
1051+
1052+ await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
1053+ }
1054+
10331055 [ Theory ]
10341056 [ InlineData ( "" , "" ) ]
10351057 [ InlineData ( "\r \n " , "\r \n " ) ]
0 commit comments