mirror of https://github.com/docker/cli.git
Use subtests
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
33d3246a37
commit
ef6cca9699
|
@ -1,7 +1,6 @@
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -56,14 +55,15 @@ func TestCompletePid(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
tc := tc
|
||||||
|
t.Run(tc.toComplete, func(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: tc.containerListFunc,
|
containerListFunc: tc.containerListFunc,
|
||||||
})
|
})
|
||||||
|
|
||||||
completions, directive := completePid(cli)(NewRunCommand(cli), nil, tc.toComplete)
|
completions, directive := completePid(cli)(NewRunCommand(cli), nil, tc.toComplete)
|
||||||
|
assert.Check(t, is.DeepEqual(completions, tc.expectedCompletions))
|
||||||
assert.DeepEqual(t, completions, tc.expectedCompletions)
|
assert.Check(t, is.Equal(directive, tc.expectedDirective))
|
||||||
assert.Equal(t, directive, tc.expectedDirective, fmt.Sprintf("wrong directive in completion for '%s'", tc.toComplete))
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +119,12 @@ func TestCompleteSecurityOpts(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
tc := tc
|
||||||
|
t.Run(tc.toComplete, func(t *testing.T) {
|
||||||
completions, directive := completeSecurityOpt(nil, nil, tc.toComplete)
|
completions, directive := completeSecurityOpt(nil, nil, tc.toComplete)
|
||||||
assert.DeepEqual(t, completions, tc.expectedCompletions)
|
assert.Check(t, is.DeepEqual(completions, tc.expectedCompletions))
|
||||||
assert.Equal(t, directive, tc.expectedDirective, fmt.Sprintf("wrong directive in completion for '%s'", tc.toComplete))
|
assert.Check(t, is.Equal(directive, tc.expectedDirective))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue