1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove unused helpers.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-08-21 18:26:55 -04:00
parent f291c959ef
commit a0c9089971

View file

@ -1,9 +1,6 @@
package testutil
import (
"strings"
"unicode"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@ -14,20 +11,3 @@ func ErrorContains(t require.TestingT, err error, expectedError string) {
require.Error(t, err)
assert.Contains(t, err.Error(), expectedError)
}
// EqualNormalizedString compare the actual value to the expected value after applying the specified
// transform function. It fails the test if these two transformed string are not equal.
// For example `EqualNormalizedString(t, RemoveSpace, "foo\n", "foo")` wouldn't fail the test as
// spaces (and thus '\n') are removed before comparing the string.
func EqualNormalizedString(t require.TestingT, transformFun func(rune) rune, actual, expected string) {
require.Equal(t, strings.Map(transformFun, expected), strings.Map(transformFun, actual))
}
// RemoveSpace returns -1 if the specified runes is considered as a space (unicode)
// and the rune itself otherwise.
func RemoveSpace(r rune) rune {
if unicode.IsSpace(r) {
return -1
}
return r
}