From f0219b6c6480187bcac808efa1c4e4ee94282c36 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 29 Jun 2016 12:38:23 -0400 Subject: [PATCH] Fix service update of Args add a unit test Signed-off-by: Daniel Nephin --- testutil/assert/assert.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testutil/assert/assert.go b/testutil/assert/assert.go index fffdfd0..a36b58b 100644 --- a/testutil/assert/assert.go +++ b/testutil/assert/assert.go @@ -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. func NilError(t TestingT, err error) { if err != nil {