@@ -77,16 +77,10 @@ public void WriteStringWithSpecialCharactersAsYamlWorks(string input, string exp
77
77
}
78
78
79
79
[ Theory ]
80
- [ InlineData ( "multiline\r \n string" , "test: |\n multiline\r \n string" ) ]
81
- [ InlineData ( "multiline\n string" , "test: |\n multiline\n string" ) ]
82
- [ InlineData ( "multiline\r string" , "test: |\n multiline\r string" ) ]
83
- [ InlineData ( "multiline\n \r string" , "test: |\n multiline\n \r string" ) ]
84
- [ InlineData ( "ends with\r \n line break\r \n " , "test: |+\n ends with\r \n line break\r \n " ) ]
85
- [ InlineData ( "ends with\n line break\n " , "test: |+\n ends with\n line break\n " ) ]
86
- [ InlineData ( "ends with\r line break\r " , "test: |+\n ends with\r line break\r " ) ]
87
- [ InlineData ( "ends with\n \r line break\n \r " , "test: |+\n ends with\n \r line break\n \r " ) ]
80
+ [ InlineData ( "multiline\r \n string" , "test: |\n multiline\n string" ) ]
81
+ [ InlineData ( "ends with\r \n line break\r \n " , "test: |+\n ends with\n line break" ) ]
88
82
[ InlineData ( " starts with\n spaces" , "test: |2\n starts with\n spaces" ) ]
89
- [ InlineData ( " starts with\n spaces, and ends with line break\n " , "test: |+2\n starts with\n spaces, and ends with line break\n " ) ]
83
+ [ InlineData ( " starts with\n spaces, and ends with line break\n " , "test: |+2\n starts with\n spaces, and ends with line break" ) ]
90
84
[ InlineData ( "contains\n \n \n empty lines" , "test: |\n contains\n \n \n empty lines" ) ]
91
85
[ InlineData ( "no line breaks fallback " , "test: 'no line breaks fallback '" ) ]
92
86
public void WriteStringWithNewlineCharactersInObjectAsYamlWorks ( string input , string expected )
@@ -100,23 +94,19 @@ public void WriteStringWithNewlineCharactersInObjectAsYamlWorks(string input, st
100
94
writer . WritePropertyName ( "test" ) ;
101
95
writer . WriteValue ( input ) ;
102
96
writer . WriteEndObject ( ) ;
103
- var actual = outputStringWriter . GetStringBuilder ( ) . ToString ( ) ;
97
+ var actual = outputStringWriter . GetStringBuilder ( ) . ToString ( )
98
+ // Normalize newline for cross platform
99
+ . Replace ( "\r " , "" ) ;
104
100
105
101
// Assert
106
102
actual . Should ( ) . Be ( expected ) ;
107
103
}
108
104
109
105
[ Theory ]
110
- [ InlineData ( "multiline\r \n string" , "- |\n multiline\r \n string" ) ]
111
- [ InlineData ( "multiline\n string" , "- |\n multiline\n string" ) ]
112
- [ InlineData ( "multiline\r string" , "- |\n multiline\r string" ) ]
113
- [ InlineData ( "multiline\n \r string" , "- |\n multiline\n \r string" ) ]
114
- [ InlineData ( "ends with\r \n line break\r \n " , "- |+\n ends with\r \n line break\r \n " ) ]
115
- [ InlineData ( "ends with\n line break\n " , "- |+\n ends with\n line break\n " ) ]
116
- [ InlineData ( "ends with\r line break\r " , "- |+\n ends with\r line break\r " ) ]
117
- [ InlineData ( "ends with\n \r line break\n \r " , "- |+\n ends with\n \r line break\n \r " ) ]
106
+ [ InlineData ( "multiline\r \n string" , "- |\n multiline\n string" ) ]
107
+ [ InlineData ( "ends with\r \n line break\r \n " , "- |+\n ends with\n line break" ) ]
118
108
[ InlineData ( " starts with\n spaces" , "- |2\n starts with\n spaces" ) ]
119
- [ InlineData ( " starts with\n spaces, and ends with line break\n " , "- |+2\n starts with\n spaces, and ends with line break\n " ) ]
109
+ [ InlineData ( " starts with\n spaces, and ends with line break\n " , "- |+2\n starts with\n spaces, and ends with line break" ) ]
120
110
[ InlineData ( "contains\n \n \n empty lines" , "- |\n contains\n \n \n empty lines" ) ]
121
111
[ InlineData ( "no line breaks fallback " , "- 'no line breaks fallback '" ) ]
122
112
public void WriteStringWithNewlineCharactersInArrayAsYamlWorks ( string input , string expected )
@@ -128,7 +118,9 @@ public void WriteStringWithNewlineCharactersInArrayAsYamlWorks(string input, str
128
118
// Act
129
119
writer . WriteStartArray ( ) ;
130
120
writer . WriteValue ( input ) ;
131
- var actual = outputStringWriter . GetStringBuilder ( ) . ToString ( ) ;
121
+ var actual = outputStringWriter . GetStringBuilder ( ) . ToString ( )
122
+ // Normalize newline for cross platform
123
+ . Replace ( "\r " , "" ) ;
132
124
133
125
// Assert
134
126
actual . Should ( ) . Be ( expected ) ;
0 commit comments