Merge pull request #201 from go-playground/v8-development

Update Error message quotes to single quotes
pull/202/head v8.6
Dean Karn 9 years ago
commit a21885483f
  1. 4
      util.go
  2. 2
      validator.go
  3. 4
      validator_test.go

@ -13,8 +13,8 @@ const (
leftBracket = "[" leftBracket = "["
rightBracket = "]" rightBracket = "]"
restrictedTagChars = ".[],|=+()`~!@#$%^&*\\\"/?<>{}" restrictedTagChars = ".[],|=+()`~!@#$%^&*\\\"/?<>{}"
restrictedAliasErr = "Alias \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation" restrictedAliasErr = "Alias '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation"
restrictedTagErr = "Tag \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation" restrictedTagErr = "Tag '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation"
) )
var ( var (

@ -30,7 +30,7 @@ const (
skipValidationTag = "-" skipValidationTag = "-"
diveTag = "dive" diveTag = "dive"
existsTag = "exists" existsTag = "exists"
fieldErrMsg = "Key: \"%s\" Error:Field validation for \"%s\" failed on the \"%s\" tag" fieldErrMsg = "Key: '%s' Error:Field validation for '%s' failed on the '%s' tag"
arrayIndexFieldName = "%s" + leftBracket + "%d" + rightBracket arrayIndexFieldName = "%s" + leftBracket + "%d" + rightBracket
mapIndexFieldName = "%s" + leftBracket + "%v" + rightBracket mapIndexFieldName = "%s" + leftBracket + "%v" + rightBracket
invalidValidation = "Invalid validation tag on field %s" invalidValidation = "Invalid validation tag on field %s"

@ -252,7 +252,7 @@ func TestAliasTags(t *testing.T) {
NotEqual(t, errs, nil) NotEqual(t, errs, nil)
AssertError(t, errs, "[0]", "[0]", "iscolor") AssertError(t, errs, "[0]", "[0]", "iscolor")
PanicMatches(t, func() { validate.RegisterAliasValidation("exists", "gt=5,lt=10") }, "Alias \"exists\" either contains restricted characters or is the same as a restricted tag needed for normal operation") PanicMatches(t, func() { validate.RegisterAliasValidation("exists", "gt=5,lt=10") }, "Alias 'exists' either contains restricted characters or is the same as a restricted tag needed for normal operation")
} }
func TestNilValidator(t *testing.T) { func TestNilValidator(t *testing.T) {
@ -4040,7 +4040,7 @@ func TestAddFunctions(t *testing.T) {
errs = validate.RegisterValidation("new", fn) errs = validate.RegisterValidation("new", fn)
Equal(t, errs, nil) Equal(t, errs, nil)
PanicMatches(t, func() { validate.RegisterValidation("dive", fn) }, "Tag \"dive\" either contains restricted characters or is the same as a restricted tag needed for normal operation") PanicMatches(t, func() { validate.RegisterValidation("dive", fn) }, "Tag 'dive' either contains restricted characters or is the same as a restricted tag needed for normal operation")
} }
func TestChangeTag(t *testing.T) { func TestChangeTag(t *testing.T) {

Loading…
Cancel
Save