1 // Package maint implements assert.TestingT for uses outside of test cases, 2 // for example, in a TestMain. 3 package maint // import "gotest.tools/v3/internal/maint" 4 5 import ( 6 "fmt" 7 "os" 8 ) 9 10 // T provides an implementation of assert.TestingT which uses os.Exit, and 11 // fmt.Println. This implementation can be used outside of test cases to provide 12 // assert.TestingT, for example in a TestMain. 13 var T = t{} 14 15 type t struct{} 16 17 // FailNow exits with a non-zero code 18 func (t t) FailNow() { 19 os.Exit(1) 20 } 21 22 // Fail exits with a non-zero code 23 func (t t) Fail() { 24 os.Exit(2) 25 } 26 27 // Log args by printing them to stdout 28 func (t t) Log(args ...interface{}) { 29 fmt.Println(args...) 30 } 31