(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestStringToSlice(t *testing.T) { |
| 125 | tests := []struct { |
| 126 | name string |
| 127 | input string |
| 128 | expected []string |
| 129 | }{ |
| 130 | { |
| 131 | name: "no element", |
| 132 | input: "", |
| 133 | expected: []string{""}, |
| 134 | }, |
| 135 | { |
| 136 | name: "one element", |
| 137 | input: "maguro", |
| 138 | expected: []string{"maguro"}, |
| 139 | }, |
| 140 | { |
| 141 | name: "comma separated", |
| 142 | input: "maguro,otoro", |
| 143 | expected: []string{"maguro", "otoro"}, |
| 144 | }, |
| 145 | { |
| 146 | name: "with spaces", |
| 147 | input: "maguro ", |
| 148 | expected: []string{"maguro"}, |
| 149 | }, |
| 150 | { |
| 151 | name: "comma separated with spaces", |
| 152 | input: "maguro , otoro, tamago", |
| 153 | expected: []string{"maguro", "otoro", "tamago"}, |
| 154 | }, |
| 155 | { |
| 156 | name: "space separated", |
| 157 | input: "maguro otoro tamago", |
| 158 | expected: []string{"magurootorotamago"}, |
| 159 | }, |
| 160 | } |
| 161 | |
| 162 | for _, tt := range tests { |
| 163 | t.Run(tt.name, func(t *testing.T) { |
| 164 | assert.Equal(t, tt.expected, StringToSlice(tt.input)) |
| 165 | }) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | func TestSliceToString(t *testing.T) { |
| 170 | tests := []struct { |
nothing calls this directly
no test coverage detected