MCPcopy Create free account
hub / github.com/go-playground/validator / TestInvalidStruct

Function TestInvalidStruct

validator_test.go:10102–10124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10100}
10101
10102func TestInvalidStruct(t *testing.T) {
10103 validate := New()
10104
10105 s := &SubTest{
10106 Test: "1",
10107 }
10108
10109 err := validate.Struct(s.Test)
10110 NotEqual(t, err, nil)
10111 Equal(t, err.Error(), "validator: (nil string)")
10112
10113 err = validate.Struct(nil)
10114 NotEqual(t, err, nil)
10115 Equal(t, err.Error(), "validator: (nil)")
10116
10117 err = validate.StructPartial(nil, "SubTest.Test")
10118 NotEqual(t, err, nil)
10119 Equal(t, err.Error(), "validator: (nil)")
10120
10121 err = validate.StructExcept(nil, "SubTest.Test")
10122 NotEqual(t, err, nil)
10123 Equal(t, err.Error(), "validator: (nil)")
10124}
10125
10126func TestInvalidValidatorFunction(t *testing.T) {
10127 validate := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
StructMethod · 0.80
StructPartialMethod · 0.80
StructExceptMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…