(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func TestSplitCpArg(t *testing.T) { |
| 153 | testcases := []struct { |
| 154 | doc string |
| 155 | path string |
| 156 | os string |
| 157 | expectedContainer string |
| 158 | expectedPath string |
| 159 | }{ |
| 160 | { |
| 161 | doc: "absolute path with colon", |
| 162 | os: "unix", |
| 163 | path: "/abs/path:withcolon", |
| 164 | expectedPath: "/abs/path:withcolon", |
| 165 | }, |
| 166 | { |
| 167 | doc: "relative path with colon", |
| 168 | path: "./relative:path", |
| 169 | expectedPath: "./relative:path", |
| 170 | }, |
| 171 | { |
| 172 | doc: "absolute path with drive", |
| 173 | os: "windows", |
| 174 | path: `d:\abs\path`, |
| 175 | expectedPath: `d:\abs\path`, |
| 176 | }, |
| 177 | { |
| 178 | doc: "no separator", |
| 179 | path: "relative/path", |
| 180 | expectedPath: "relative/path", |
| 181 | }, |
| 182 | { |
| 183 | doc: "with separator", |
| 184 | path: "container:/opt/foo", |
| 185 | expectedPath: "/opt/foo", |
| 186 | expectedContainer: "container", |
| 187 | }, |
| 188 | } |
| 189 | for _, tc := range testcases { |
| 190 | t.Run(tc.doc, func(t *testing.T) { |
| 191 | if tc.os == "windows" && runtime.GOOS != "windows" { |
| 192 | t.Skip("skipping windows test on non-windows platform") |
| 193 | } |
| 194 | if tc.os == "unix" && runtime.GOOS == "windows" { |
| 195 | t.Skip("skipping unix test on windows") |
| 196 | } |
| 197 | |
| 198 | ctr, path := splitCpArg(tc.path) |
| 199 | assert.Check(t, is.Equal(tc.expectedContainer, ctr)) |
| 200 | assert.Check(t, is.Equal(tc.expectedPath, path)) |
| 201 | }) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | func TestRunCopyFromContainerToFilesystemIrregularDestination(t *testing.T) { |
| 206 | cli := test.NewFakeCli(nil) |
nothing calls this directly
no test coverage detected
searching dependent graphs…