...
Run Format

Source file src/cmd/go/testdata/flag_test.go

Documentation: cmd/go/testdata

     1  package flag_test
     2  
     3  import (
     4  	"flag"
     5  	"log"
     6  	"testing"
     7  )
     8  
     9  var v = flag.Int("v", 0, "v flag")
    10  
    11  // Run this as go test pkg -v=7
    12  func TestVFlagIsSet(t *testing.T) {
    13  	if *v != 7 {
    14  		log.Fatal("v flag not set")
    15  	}
    16  }
    17  

View as plain text