@@ -41,7 +41,7 @@ private C() { }
41
41
var expected = this . CSharpDiagnostic ( DeclarePublicAPIAnalyzer . DeclareNewApiRule ) . WithArguments ( "C" ) . WithLocation ( 2 , 14 ) ;
42
42
await this . VerifyCSharpDiagnosticAsync ( source , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
43
43
44
- string fixedApi = "C" ;
44
+ string fixedApi = "C" + Environment . NewLine ;
45
45
var updatedApi = await this . GetUpdatedApiAsync ( source , 0 , CancellationToken . None ) . ConfigureAwait ( false ) ;
46
46
47
47
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
@@ -89,27 +89,27 @@ public void Method() { }
89
89
90
90
await this . VerifyCSharpDiagnosticAsync ( source , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
91
91
92
- string fixedApi = "C" ;
92
+ string fixedApi = "C" + Environment . NewLine ;
93
93
var updatedApi = await this . GetUpdatedApiAsync ( source , 0 , CancellationToken . None ) . ConfigureAwait ( false ) ;
94
94
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
95
95
96
- fixedApi = "C.C() -> void" ;
96
+ fixedApi = "C.C() -> void" + Environment . NewLine ;
97
97
updatedApi = await this . GetUpdatedApiAsync ( source , 1 , CancellationToken . None ) . ConfigureAwait ( false ) ;
98
98
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
99
99
100
- fixedApi = "C.Field -> int" ;
100
+ fixedApi = "C.Field -> int" + Environment . NewLine ;
101
101
updatedApi = await this . GetUpdatedApiAsync ( source , 2 , CancellationToken . None ) . ConfigureAwait ( false ) ;
102
102
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
103
103
104
- fixedApi = "C.Property.get -> int" ;
104
+ fixedApi = "C.Property.get -> int" + Environment . NewLine ;
105
105
updatedApi = await this . GetUpdatedApiAsync ( source , 3 , CancellationToken . None ) . ConfigureAwait ( false ) ;
106
106
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
107
107
108
- fixedApi = "C.Property.set -> void" ;
108
+ fixedApi = "C.Property.set -> void" + Environment . NewLine ;
109
109
updatedApi = await this . GetUpdatedApiAsync ( source , 4 , CancellationToken . None ) . ConfigureAwait ( false ) ;
110
110
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
111
111
112
- fixedApi = "C.Method() -> void" ;
112
+ fixedApi = "C.Method() -> void" + Environment . NewLine ;
113
113
updatedApi = await this . GetUpdatedApiAsync ( source , 5 , CancellationToken . None ) . ConfigureAwait ( false ) ;
114
114
Assert . Equal ( fixedApi , updatedApi . ToString ( ) ) ;
115
115
}
@@ -730,7 +730,8 @@ private C() { }
730
730
731
731
this . shippedText = string . Empty ;
732
732
this . unshippedText = string . Empty ;
733
- var fixedUnshippedText = @"C" ;
733
+ var fixedUnshippedText = @"C
734
+ " ;
734
735
735
736
await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
736
737
}
@@ -752,7 +753,8 @@ public class C2 { }
752
753
var fixedUnshippedText = @"C
753
754
C.Field -> int
754
755
C2
755
- C2.C2() -> void" ;
756
+ C2.C2() -> void
757
+ " ;
756
758
757
759
await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
758
760
}
@@ -848,7 +850,8 @@ public class C2 { }
848
850
C.CC.Field -> int
849
851
C.Field -> int
850
852
C2
851
- C2.C2() -> void" ;
853
+ C2.C2() -> void
854
+ " ;
852
855
853
856
await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
854
857
}
@@ -993,7 +996,8 @@ public class C2 { }
993
996
var fixedUnshippedText = @"C
994
997
C.Field -> int
995
998
C2
996
- C2.C2() -> void" ;
999
+ C2.C2() -> void
1000
+ " ;
997
1001
998
1002
await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
999
1003
}
@@ -1030,6 +1034,24 @@ public class C2 { }
1030
1034
await this . VerifyCSharpUnshippedFileFixAsync ( source , fixedUnshippedText , numberOfFixAllIterations : 2 , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
1031
1035
}
1032
1036
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
+
1033
1055
[ Theory ]
1034
1056
[ InlineData ( "" , "" ) ]
1035
1057
[ InlineData ( "\r \n " , "\r \n " ) ]
0 commit comments