github.com/asifdxtreme/cli@v6.1.3-0.20150123051144-9ead8700b4ae+incompatible/testhelpers/assert/strings.go (about) 1 package assert 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 func JSONStringEquals(actual string, expected string, msgAndArgs ...interface{}) bool { 9 if RemoveWhitespace(actual) == RemoveWhitespace(expected) { 10 return true 11 } 12 Fail(fmt.Sprintf("Not equal:\n%s\n%s", actual, expected), msgAndArgs...) 13 return false 14 } 15 16 func RemoveWhitespace(body string) string { 17 body = strings.Replace(body, " ", "", -1) 18 body = strings.Replace(body, "\n", "", -1) 19 body = strings.Replace(body, "\r", "", -1) 20 body = strings.Replace(body, "\t", "", -1) 21 return body 22 }