(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestSplitMessage(t *testing.T) { |
| 183 | tests := []struct { |
| 184 | name string |
| 185 | input string |
| 186 | expSubject string |
| 187 | expBody string |
| 188 | }{ |
| 189 | { |
| 190 | name: "remove_trailing_spaces_in_lines", |
| 191 | input: "" + |
| 192 | "ABC \n" + |
| 193 | "\t\t\n" + |
| 194 | "DEF\n", |
| 195 | expSubject: "ABC", |
| 196 | expBody: "DEF\n", |
| 197 | }, |
| 198 | { |
| 199 | name: "add_eof_to_the_last_line", |
| 200 | input: "" + |
| 201 | "ABC\n" + |
| 202 | "DEF", |
| 203 | expSubject: "ABC DEF", |
| 204 | expBody: "", |
| 205 | }, |
| 206 | { |
| 207 | name: "add_eof_to_the_last_line_of_body", |
| 208 | input: "" + |
| 209 | "ABC\n" + |
| 210 | "DEF\n" + |
| 211 | "\n" + |
| 212 | "GHI", |
| 213 | expSubject: "ABC DEF", |
| 214 | expBody: "GHI\n", |
| 215 | }, |
| 216 | { |
| 217 | name: "remove_consecutive_empty_lines", |
| 218 | input: "" + |
| 219 | "ABC\n" + |
| 220 | "\n" + |
| 221 | "\t\t\n" + |
| 222 | "\n" + |
| 223 | "DEF\n", |
| 224 | expSubject: "ABC", |
| 225 | expBody: "DEF\n", |
| 226 | }, |
| 227 | { |
| 228 | name: "multi_line_body", |
| 229 | input: "" + |
| 230 | "ABC\n" + |
| 231 | "\n" + |
| 232 | "DEF\n" + |
| 233 | "GHI\n", |
| 234 | expSubject: "ABC", |
| 235 | expBody: "DEF\nGHI\n", |
| 236 | }, |
| 237 | { |
| 238 | name: "remove_empty_lines_from_the_message_bottom", |
| 239 | input: "" + |
nothing calls this directly
no test coverage detected
searching dependent graphs…