History

Better T log member names

Gregory Petrosyan committed 6 years ago

Commit 4e9a2f21 parent 80b53ec2 files · +22 −22Browse files

Unified · Split

2 files
  1. engine.go +21 −21
  2. generator.go +1 −1
engine.go+21−21
@@ -195,7 +195,7 @@ func findBug(tb tb, seed uint64, prop func(*T)) (uint64, int, int, *testError) { · 194 unmodified lines
195195 }
196196
197197 func checkOnce(t *T, prop func(*T)) (err *testError) {
198− if t.log && t.tb != nil {
198+ if t.tbLog && t.tb != nil {
199199 t.tb.Helper()
200200 }
201201 defer func() { err = panicToError(recover(), 3) }()
@@ -301,8 +301,8 @@ type tb interface { · 99 unmodified lines
301301
302302 type T struct {
303303 tb // unnamed to force re-export of (*T).Helper()
304− log bool
305− rapidLog *log.Logger
304+ tbLog bool
305+ rawLog *log.Logger
306306 s bitStream
307307 draws int
308308 refDraws []value
@@ -310,10 +310,10 @@ type T struct { · 1 unmodified line
310310 failed stopTest
311311 }
312312
313−func newT(tb tb, s bitStream, log_ bool, refDraws ...value) *T {
313+func newT(tb tb, s bitStream, tbLog bool, refDraws ...value) *T {
314314 t := &T{
315315 tb: tb,
316− log: log_,
316+ tbLog: tbLog,
317317 s: s,
318318 refDraws: refDraws,
319319 }
@@ -324,7 +324,7 @@ func newT(tb tb, s bitStream, log_ bool, refDraws ...value) *T { · 4 unmodified lines
324324 testName = tb.Name()
325325 }
326326
327− t.rapidLog = log.New(os.Stdout, fmt.Sprintf("[%v] ", testName), 0)
327+ t.rawLog = log.New(os.Stdout, fmt.Sprintf("[%v] ", testName), 0)
328328 }
329329
330330 return t
@@ -340,12 +340,12 @@ func (t *T) draw(g *Generator, label string) value { · 9 unmodified lines
340340 }
341341 }
342342
343− if t.log || t.rapidLog != nil {
343+ if t.tbLog || t.rawLog != nil {
344344 if label == "" {
345345 label = fmt.Sprintf("#%v", t.draws)
346346 }
347347
348− if t.log && t.tb != nil {
348+ if t.tbLog && t.tb != nil {
349349 t.tb.Helper()
350350 }
351351 t.Logf("[rapid] draw %v: %#v", label, v)
@@ -357,22 +357,22 @@ func (t *T) draw(g *Generator, label string) value { · 5 unmodified lines
357357 }
358358
359359 func (t *T) shouldLog() bool {
360− return t.rapidLog != nil || (t.log && t.tb != nil)
360+ return t.rawLog != nil || (t.tbLog && t.tb != nil)
361361 }
362362
363363 func (t *T) Logf(format string, args ...interface{}) {
364− if t.rapidLog != nil {
365− t.rapidLog.Printf(format, args...)
366− } else if t.log && t.tb != nil {
364+ if t.rawLog != nil {
365+ t.rawLog.Printf(format, args...)
366+ } else if t.tbLog && t.tb != nil {
367367 t.tb.Helper()
368368 t.tb.Logf(format, args...)
369369 }
370370 }
371371
372372 func (t *T) Log(args ...interface{}) {
373− if t.rapidLog != nil {
374− t.rapidLog.Print(args...)
375− } else if t.log && t.tb != nil {
373+ if t.rawLog != nil {
374+ t.rawLog.Print(args...)
375+ } else if t.tbLog && t.tb != nil {
376376 t.tb.Helper()
377377 t.tb.Log(args...)
378378 }
@@ -380,7 +380,7 @@ func (t *T) Log(args ...interface{}) { · 1 unmodified line
380380
381381 // Skipf is equivalent to Logf followed by SkipNow.
382382 func (t *T) Skipf(format string, args ...interface{}) {
383− if t.log && t.tb != nil {
383+ if t.tbLog && t.tb != nil {
384384 t.tb.Helper()
385385 }
386386 t.Logf(format, args...)
@@ -389,7 +389,7 @@ func (t *T) Skipf(format string, args ...interface{}) { · 2 unmodified lines
389389
390390 // Skip is equivalent to Log followed by SkipNow.
391391 func (t *T) Skip(args ...interface{}) {
392− if t.log && t.tb != nil {
392+ if t.tbLog && t.tb != nil {
393393 t.tb.Helper()
394394 }
395395 t.Log(args...)
@@ -409,7 +409,7 @@ func (t *T) SkipNow() { · 13 unmodified lines
409409
410410 // Errorf is equivalent to Logf followed by Fail.
411411 func (t *T) Errorf(format string, args ...interface{}) {
412− if t.log && t.tb != nil {
412+ if t.tbLog && t.tb != nil {
413413 t.tb.Helper()
414414 }
415415 t.Logf(format, args...)
@@ -418,7 +418,7 @@ func (t *T) Errorf(format string, args ...interface{}) { · 2 unmodified lines
418418
419419 // Error is equivalent to Log followed by Fail.
420420 func (t *T) Error(args ...interface{}) {
421− if t.log && t.tb != nil {
421+ if t.tbLog && t.tb != nil {
422422 t.tb.Helper()
423423 }
424424 t.Log(args...)
@@ -427,7 +427,7 @@ func (t *T) Error(args ...interface{}) { · 2 unmodified lines
427427
428428 // Fatalf is equivalent to Logf followed by FailNow.
429429 func (t *T) Fatalf(format string, args ...interface{}) {
430− if t.log && t.tb != nil {
430+ if t.tbLog && t.tb != nil {
431431 t.tb.Helper()
432432 }
433433 t.Logf(format, args...)
@@ -436,7 +436,7 @@ func (t *T) Fatalf(format string, args ...interface{}) { · 2 unmodified lines
436436
437437 // Fatal is equivalent to Log followed by FailNow.
438438 func (t *T) Fatal(args ...interface{}) {
439− if t.log && t.tb != nil {
439+ if t.tbLog && t.tb != nil {
440440 t.tb.Helper()
441441 }
442442 t.Log(args...)
generator.go+1−1
@@ -42,7 +42,7 @@ func (g *Generator) type_() reflect.Type { · 41 unmodified lines
4242 }
4343
4444 func (g *Generator) Draw(t *T, label string) interface{} {
45− if t.log && t.tb != nil {
45+ if t.tbLog && t.tb != nil {
4646 t.tb.Helper()
4747 }
4848 return t.draw(g, label)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t