github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/test_flag.txt (about)

     1  [short] skip
     2  
     3  go test flag_test.go -v -args -v=7 # Two distinct -v flags
     4  go test -v flag_test.go -args -v=7 # Two distinct -v flags
     5  
     6  -- flag_test.go --
     7  package flag_test
     8  
     9  import (
    10  	"flag"
    11  	"log"
    12  	"testing"
    13  )
    14  
    15  var v = flag.Int("v", 0, "v flag")
    16  
    17  // Run this as go test pkg -v=7
    18  func TestVFlagIsSet(t *testing.T) {
    19  	if *v != 7 {
    20  		log.Fatal("v flag not set")
    21  	}
    22  }