Codebase list golang-github-matryer-is / f388102
New upstream version 1.2.0 Sascha Steinbiss 5 years ago
1 changed file(s) with 6 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
7070 colorful bool
7171 }
7272
73 var isColorful bool
73 var noColorFlag bool
7474
7575 func init() {
76 noColor := flag.Bool("nocolor", false, "turns off colors")
77 flag.Parse()
78 isColorful = !*noColor
76 flag.BoolVar(&noColorFlag, "nocolor", false, "turns off colors")
7977 }
8078
8179 // New makes a new testing helper using the specified
8381 // In strict mode, failures call T.FailNow causing the test
8482 // to be aborted. See NewRelaxed for alternative behavior.
8583 func New(t T) *I {
86 return &I{t, t.FailNow, os.Stdout, isColorful}
84 return &I{t, t.FailNow, os.Stdout, !noColorFlag}
8785 }
8886
8987 // NewRelaxed makes a new testing helper using the specified
9189 // In relaxed mode, failures call T.Fail allowing
9290 // multiple failures per test.
9391 func NewRelaxed(t T) *I {
94 return &I{t, t.Fail, os.Stdout, isColorful}
92 return &I{t, t.Fail, os.Stdout, !noColorFlag}
9593 }
9694
9795 func (is *I) log(args ...interface{}) {
188186 // pattern:
189187 //
190188 // func Test(t *testing.T) {
191 // is := is.New(t)
189 // is := is.NewRelaxed(t)
192190 // t.Run("sub", func(t *testing.T) {
193 // is := is.New(t)
191 // is := is.NewRelaxed(t)
194192 // // TODO: test
195193 // })
196194 // }