(t *testing.T)
| 17 | import "testing" |
| 18 | |
| 19 | func TestCleanUpWhitespace(t *testing.T) { |
| 20 | tests := []struct { |
| 21 | name string |
| 22 | input string |
| 23 | exp string |
| 24 | }{ |
| 25 | { |
| 26 | name: "remove_trailing_spaces_in_lines", |
| 27 | input: "" + |
| 28 | "ABC \n" + |
| 29 | "\t\t\n" + |
| 30 | "DEF\t\n", |
| 31 | exp: "" + |
| 32 | "ABC\n" + |
| 33 | "\n" + |
| 34 | "DEF\n", |
| 35 | }, |
| 36 | { |
| 37 | name: "add_eof_to_the_last_line", |
| 38 | input: "" + |
| 39 | "ABC\n" + |
| 40 | "DEF", |
| 41 | exp: "" + |
| 42 | "ABC\n" + |
| 43 | "DEF\n", |
| 44 | }, |
| 45 | { |
| 46 | name: "remove_consecutive_empty_lines", |
| 47 | input: "" + |
| 48 | "ABC\n" + |
| 49 | "\n" + |
| 50 | "\t\t\n" + |
| 51 | "\n" + |
| 52 | "DEF\n", |
| 53 | exp: "" + |
| 54 | "ABC\n" + |
| 55 | "\n" + |
| 56 | "DEF\n", |
| 57 | }, |
| 58 | { |
| 59 | name: "remove_empty_lines_from_the_message_bottom", |
| 60 | input: "" + |
| 61 | "ABC\n" + |
| 62 | "\n" + |
| 63 | "DEF\n" + |
| 64 | "\n" + |
| 65 | "\n" + |
| 66 | "\n", |
| 67 | exp: "" + |
| 68 | "ABC\n" + |
| 69 | "\n" + |
| 70 | "DEF\n", |
| 71 | }, |
| 72 | { |
| 73 | name: "remove_empty_lines_from_the_message_top", |
| 74 | input: "" + |
| 75 | "\n" + |
| 76 | "\n" + |
nothing calls this directly
no test coverage detected
searching dependent graphs…