Merge pull request #5230 from thaJeztah/clean_skip

cli/command/container: TestSplitCpArg: cleaner skip
This commit is contained in:
Paweł Gronowski 2024-07-05 10:41:36 +02:00 committed by GitHub
commit be6a415f86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -14,7 +14,6 @@ import (
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp" is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs" "gotest.tools/v3/fs"
"gotest.tools/v3/skip"
) )
func TestRunCopyWithInvalidArguments(t *testing.T) { func TestRunCopyWithInvalidArguments(t *testing.T) {
@ -151,7 +150,7 @@ func TestSplitCpArg(t *testing.T) {
}{ }{
{ {
doc: "absolute path with colon", doc: "absolute path with colon",
os: "linux", os: "unix",
path: "/abs/path:withcolon", path: "/abs/path:withcolon",
expectedPath: "/abs/path:withcolon", expectedPath: "/abs/path:withcolon",
}, },
@ -181,7 +180,12 @@ func TestSplitCpArg(t *testing.T) {
for _, tc := range testcases { for _, tc := range testcases {
tc := tc tc := tc
t.Run(tc.doc, func(t *testing.T) { t.Run(tc.doc, func(t *testing.T) {
skip.If(t, tc.os == "windows" && runtime.GOOS != "windows" || tc.os == "linux" && runtime.GOOS == "windows") if tc.os == "windows" && runtime.GOOS != "windows" {
t.Skip("skipping windows test on non-windows platform")
}
if tc.os == "unix" && runtime.GOOS == "windows" {
t.Skip("skipping unix test on windows")
}
ctr, path := splitCpArg(tc.path) ctr, path := splitCpArg(tc.path)
assert.Check(t, is.Equal(tc.expectedContainer, ctr)) assert.Check(t, is.Equal(tc.expectedContainer, ctr))