github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/validate/test/disable_test.go (about) 1 package main 2 3 import ( 4 "github.com/isyscore/isc-gobase/validate" 5 "testing" 6 ) 7 8 type DisableEntity1 struct { 9 Name string `match:"value=zhou" disable:"true"` 10 Age int 11 } 12 13 func TestDisable1(t *testing.T) { 14 var value DisableEntity1 15 var result bool 16 var err string 17 18 //测试 正常情况 19 value = DisableEntity1{Name: "zhou"} 20 result, err = validate.Check(value, "name") 21 TrueErr(t, result, err) 22 23 // 测试 正常情况 24 value = DisableEntity1{Name: "chenzhen"} 25 result, err = validate.Check(value, "name") 26 TrueErr(t, result, err) 27 }