aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/test_trimpath_main.txt
blob: c07621245fbdfcdda6057277ec43ef27cb48730e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[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()
}