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 {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
tc := tc
|
||||||
containerListFunc: tc.containerListFunc,
|
t.Run(tc.toComplete, func(t *testing.T) {
|
||||||
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
|
containerListFunc: tc.containerListFunc,
|
||||||
|
})
|
||||||
|
completions, directive := completePid(cli)(NewRunCommand(cli), nil, tc.toComplete)
|
||||||
|
assert.Check(t, is.DeepEqual(completions, tc.expectedCompletions))
|
||||||
|
assert.Check(t, is.Equal(directive, tc.expectedDirective))
|
||||||
})
|
})
|
||||||
|
|
||||||
completions, directive := completePid(cli)(NewRunCommand(cli), nil, tc.toComplete)
|
|
||||||
|
|
||||||
assert.DeepEqual(t, completions, tc.expectedCompletions)
|
|
||||||
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 {
|
||||||
completions, directive := completeSecurityOpt(nil, nil, tc.toComplete)
|
tc := tc
|
||||||
assert.DeepEqual(t, completions, tc.expectedCompletions)
|
t.Run(tc.toComplete, func(t *testing.T) {
|
||||||
assert.Equal(t, directive, tc.expectedDirective, fmt.Sprintf("wrong directive in completion for '%s'", tc.toComplete))
|
completions, directive := completeSecurityOpt(nil, nil, tc.toComplete)
|
||||||
|
assert.Check(t, is.DeepEqual(completions, tc.expectedCompletions))
|
||||||
|
assert.Check(t, is.Equal(directive, tc.expectedDirective))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue