blob: c07621245fbdfcdda6057277ec43ef27cb48730e [file] [log] [blame]
[short] skip
go test -trimpath -v .
! stdout '[/\\]pkg_test[/\\]'
stdout -count=2 '[/\\]pkg[/\\]'
-- go.mod --
module example.com/pkg
go 1.17
-- main.go --
package main
import "runtime"
func PrintFile() {
_, file, _, _ := runtime.Caller(0)
println(file)
}
-- main_test.go --
package main
import (
"runtime"
"testing"
)
func PrintFileForTest() {
_, file, _, _ := runtime.Caller(0)
println(file)
}
func TestMain(m *testing.M) {
PrintFile()
PrintFileForTest()
}