(t *testing.T)
| 165 | } |
| 166 | |
| 167 | func TestVolumeContextWriteJSONField(t *testing.T) { |
| 168 | volumes := []volume.Volume{ |
| 169 | {Driver: "foo", Name: "foobar_baz"}, |
| 170 | {Driver: "bar", Name: "foobar_bar"}, |
| 171 | } |
| 172 | out := bytes.NewBufferString("") |
| 173 | err := VolumeWrite(Context{Format: "{{json .Name}}", Output: out}, volumes) |
| 174 | if err != nil { |
| 175 | t.Fatal(err) |
| 176 | } |
| 177 | for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") { |
| 178 | msg := fmt.Sprintf("Output: line %d: %s", i, line) |
| 179 | var s string |
| 180 | err := json.Unmarshal([]byte(line), &s) |
| 181 | assert.NilError(t, err, msg) |
| 182 | assert.Check(t, is.Equal(volumes[i].Name, s), msg) |
| 183 | } |
| 184 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…