gotest.tools/gotestsum@v1.11.0/cmd/tool/slowest/ast_test.go (about)

     1  package slowest
     2  
     3  import (
     4  	"bytes"
     5  	"go/format"
     6  	"go/token"
     7  	"testing"
     8  
     9  	"gotest.tools/v3/assert"
    10  )
    11  
    12  func TestParseSkipStatement_Preset_testingShort(t *testing.T) {
    13  	stmt, err := parseSkipStatement("testing.Short")
    14  	assert.NilError(t, err)
    15  	expected := `if testing.Short() {
    16  	t.Skip("too slow for testing.Short")
    17  }`
    18  	buf := new(bytes.Buffer)
    19  	err = format.Node(buf, token.NewFileSet(), stmt)
    20  	assert.NilError(t, err)
    21  	assert.DeepEqual(t, buf.String(), expected)
    22  }