(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestCheckpointContextFormatWrite(t *testing.T) { |
| 13 | cases := []struct { |
| 14 | context formatter.Context |
| 15 | expected string |
| 16 | }{ |
| 17 | { |
| 18 | formatter.Context{Format: newFormat(defaultCheckpointFormat)}, |
| 19 | `CHECKPOINT NAME |
| 20 | checkpoint-1 |
| 21 | checkpoint-2 |
| 22 | checkpoint-3 |
| 23 | `, |
| 24 | }, |
| 25 | { |
| 26 | formatter.Context{Format: newFormat("{{.Name}}")}, |
| 27 | `checkpoint-1 |
| 28 | checkpoint-2 |
| 29 | checkpoint-3 |
| 30 | `, |
| 31 | }, |
| 32 | { |
| 33 | formatter.Context{Format: newFormat("{{.Name}}:")}, |
| 34 | `checkpoint-1: |
| 35 | checkpoint-2: |
| 36 | checkpoint-3: |
| 37 | `, |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | for _, testcase := range cases { |
| 42 | out := bytes.NewBufferString("") |
| 43 | testcase.context.Output = out |
| 44 | err := formatWrite(testcase.context, []checkpoint.Summary{ |
| 45 | {Name: "checkpoint-1"}, |
| 46 | {Name: "checkpoint-2"}, |
| 47 | {Name: "checkpoint-3"}, |
| 48 | }) |
| 49 | assert.NilError(t, err) |
| 50 | assert.Equal(t, out.String(), testcase.expected) |
| 51 | } |
| 52 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…