github.com/seh/gb@v0.4.4-0.20160724065125-065d2b2b1ba1/testdata/src/testflags/testflags_test.go (about)

     1  package testflags
     2  
     3  import (
     4  	"flag"
     5  	"testing"
     6  )
     7  
     8  var debug bool
     9  
    10  func init() {
    11  	flag.BoolVar(&debug, "debug", false, "Enable debug output.")
    12  	flag.Parse()
    13  }
    14  
    15  func TestDebug(t *testing.T) {
    16  	if !debug {
    17  		t.Error("debug not true!")
    18  	}
    19  }