(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestFormatSlice(t *testing.T) { |
| 60 | tests := []struct { |
| 61 | name string |
| 62 | values []string |
| 63 | indent uint |
| 64 | lineLength uint |
| 65 | prependWith string |
| 66 | appendWith string |
| 67 | sort bool |
| 68 | wants string |
| 69 | }{ |
| 70 | { |
| 71 | name: "empty", |
| 72 | lineLength: 10, |
| 73 | values: []string{}, |
| 74 | wants: "", |
| 75 | }, |
| 76 | { |
| 77 | name: "empty with indent", |
| 78 | lineLength: 10, |
| 79 | indent: 2, |
| 80 | values: []string{}, |
| 81 | wants: " ", |
| 82 | }, |
| 83 | { |
| 84 | name: "single", |
| 85 | lineLength: 10, |
| 86 | values: []string{"foo"}, |
| 87 | wants: "foo", |
| 88 | }, |
| 89 | { |
| 90 | name: "single with indent", |
| 91 | lineLength: 10, |
| 92 | indent: 2, |
| 93 | values: []string{"foo"}, |
| 94 | wants: " foo", |
| 95 | }, |
| 96 | { |
| 97 | name: "long single with indent", |
| 98 | lineLength: 10, |
| 99 | indent: 2, |
| 100 | values: []string{"some-long-value"}, |
| 101 | wants: " some-long-value", |
| 102 | }, |
| 103 | { |
| 104 | name: "exact line length", |
| 105 | lineLength: 4, |
| 106 | values: []string{"a", "b"}, |
| 107 | wants: "a, b", |
| 108 | }, |
| 109 | { |
| 110 | name: "values longer than line length", |
| 111 | lineLength: 4, |
| 112 | values: []string{"long-value", "long-value"}, |
| 113 | wants: "long-value,\nlong-value", |
| 114 | }, |
| 115 | { |
| 116 | name: "zero line length (no wrapping expected)", |
nothing calls this directly
no test coverage detected