Text file src/cmd/go/testdata/script/test_trimpath_test_suffix.txt

     1  [short] skip
     2  
     3  go test -trimpath -v .
     4  ! stdout '[/\\]pkg_test_test[/\\]'
     5  stdout -count=2 '[/\\]pkg_test[/\\]'
     6  
     7  -- go.mod --
     8  module example.com/pkg_test
     9  
    10  go 1.17
    11  
    12  -- pkg.go --
    13  package pkg_test
    14  
    15  import "runtime"
    16  
    17  func PrintFile() {
    18  	_, file, _, _ := runtime.Caller(0)
    19  	println(file)
    20  }
    21  
    22  -- pkg_x_test.go --
    23  package pkg_test_test
    24  
    25  import (
    26  	"runtime"
    27  	"testing"
    28  
    29  	"example.com/pkg_test"
    30  )
    31  
    32  func PrintFileForTest() {
    33  	_, file, _, _ := runtime.Caller(0)
    34  	println(file)
    35  }
    36  
    37  func TestMain(m *testing.M) {
    38  	pkg_test.PrintFile()
    39  	PrintFileForTest()
    40  }
    41  

View as plain text