Fix service update of Args
add a unit test Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
754ae20ec5
commit
f0219b6c64
1 changed files with 15 additions and 0 deletions
|
@ -19,6 +19,21 @@ func Equal(t TestingT, actual, expected interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//EqualStringSlice compares two slices and fails the test if they do not contain
|
||||||
|
// the same items.
|
||||||
|
func EqualStringSlice(t TestingT, actual, expected []string) {
|
||||||
|
if len(actual) != len(expected) {
|
||||||
|
t.Fatalf("Expected (length %d): %q\nActual (length %d): %q",
|
||||||
|
len(expected), expected, len(actual), actual)
|
||||||
|
}
|
||||||
|
for i, item := range actual {
|
||||||
|
if item != expected[i] {
|
||||||
|
t.Fatalf("Slices differ at element %d, expected %q got %q",
|
||||||
|
i, expected[i], item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NilError asserts that the error is nil, otherwise it fails the test.
|
// NilError asserts that the error is nil, otherwise it fails the test.
|
||||||
func NilError(t TestingT, err error) {
|
func NilError(t TestingT, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue