...

Source file src/gotest.tools/v3/skip/example_test.go

Documentation: gotest.tools/v3/skip

     1  package skip_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/skip"
     7  )
     8  
     9  var apiVersion = ""
    10  
    11  type env struct{}
    12  
    13  func (e env) hasFeature(_ string) bool { return false }
    14  
    15  var testEnv = env{}
    16  
    17  func MissingFeature() bool { return false }
    18  
    19  var t = &testing.T{}
    20  
    21  func ExampleIf() {
    22  	//   --- SKIP: TestName (0.00s)
    23  	//           skip.go:19: MissingFeature
    24  	skip.If(t, MissingFeature)
    25  
    26  	//   --- SKIP: TestName (0.00s)
    27  	//           skip.go:19: MissingFeature: coming soon
    28  	skip.If(t, MissingFeature, "coming soon")
    29  }
    30  
    31  func ExampleIf_withExpression() {
    32  	//   --- SKIP: TestName (0.00s)
    33  	//           skip.go:19: apiVersion < version("v1.24")
    34  	skip.If(t, apiVersion < version("v1.24"))
    35  
    36  	//   --- SKIP: TestName (0.00s)
    37  	//           skip.go:19: !textenv.hasFeature("build"): coming soon
    38  	skip.If(t, !testEnv.hasFeature("build"), "coming soon")
    39  }
    40  
    41  func version(v string) string {
    42  	return v
    43  }
    44  

View as plain text