github.com/go-email-validator/go-email-validator@v0.0.0-20230409163946-b8b9e6a0552e/pkg/ev/evtests/test.go (about) 1 package evtests 2 3 import ( 4 "flag" 5 "os" 6 "testing" 7 ) 8 9 const usageFunctionalMessage = "run functional tests" 10 11 var functionalFlag = flag.Bool("functional", false, usageFunctionalMessage) 12 var functionalShortFlag = flag.Bool("func", false, usageFunctionalMessage) 13 14 // TestMain initialize flags 15 func TestMain(m *testing.M) { 16 flag.Parse() 17 18 os.Exit(m.Run()) 19 } 20 21 // FunctionalSkip skips test if "-func" or "-functional" was not put in `go test` 22 func FunctionalSkip(t *testing.T) { 23 if !*functionalFlag && !*functionalShortFlag { 24 t.Skip() 25 } 26 } 27 28 // ToError casts interface{} to error 29 func ToError(ret interface{}) error { 30 if ret != nil { 31 return ret.(error) 32 } 33 return nil 34 }