(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestVolumeContextWrite(t *testing.T) { |
| 58 | cases := []struct { |
| 59 | context Context |
| 60 | expected string |
| 61 | }{ |
| 62 | // Errors |
| 63 | { |
| 64 | Context{Format: "{{InvalidFunction}}"}, |
| 65 | `template parsing error: template: :1: function "InvalidFunction" not defined`, |
| 66 | }, |
| 67 | { |
| 68 | Context{Format: "{{nil}}"}, |
| 69 | `template parsing error: template: :1:2: executing "" at <nil>: nil is not a command`, |
| 70 | }, |
| 71 | // Table format |
| 72 | { |
| 73 | Context{Format: NewVolumeFormat("table", false)}, |
| 74 | `DRIVER VOLUME NAME |
| 75 | foo foobar_baz |
| 76 | bar foobar_bar |
| 77 | `, |
| 78 | }, |
| 79 | { |
| 80 | Context{Format: NewVolumeFormat("table", true)}, |
| 81 | `foobar_baz |
| 82 | foobar_bar |
| 83 | `, |
| 84 | }, |
| 85 | { |
| 86 | Context{Format: NewVolumeFormat("table {{.Name}}", false)}, |
| 87 | `VOLUME NAME |
| 88 | foobar_baz |
| 89 | foobar_bar |
| 90 | `, |
| 91 | }, |
| 92 | { |
| 93 | Context{Format: NewVolumeFormat("table {{.Name}}", true)}, |
| 94 | `VOLUME NAME |
| 95 | foobar_baz |
| 96 | foobar_bar |
| 97 | `, |
| 98 | }, |
| 99 | // Raw Format |
| 100 | { |
| 101 | Context{Format: NewVolumeFormat("raw", false)}, |
| 102 | `name: foobar_baz |
| 103 | driver: foo |
| 104 | |
| 105 | name: foobar_bar |
| 106 | driver: bar |
| 107 | |
| 108 | `, |
| 109 | }, |
| 110 | { |
| 111 | Context{Format: NewVolumeFormat("raw", true)}, |
| 112 | `name: foobar_baz |
| 113 | name: foobar_bar |
| 114 | `, |
nothing calls this directly
no test coverage detected
searching dependent graphs…