-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtestpkg.go
More file actions
36 lines (32 loc) · 770 Bytes
/
testpkg.go
File metadata and controls
36 lines (32 loc) · 770 Bytes
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
// +build !go1.16
package main
import (
"go/build"
gbuild "github.com/goplusjs/gopherjs/build"
)
func makeTestPkg(pkg *gbuild.PackageData, xtest bool) *gbuild.PackageData {
if xtest {
return &gbuild.PackageData{
Package: &build.Package{
Name: pkg.Name + "_test",
ImportPath: pkg.ImportPath + "_test",
Dir: pkg.Dir,
GoFiles: pkg.XTestGoFiles,
Imports: pkg.XTestImports,
},
IsTest: true,
}
} else {
return &gbuild.PackageData{
Package: &build.Package{
Name: pkg.Name,
ImportPath: pkg.ImportPath,
Dir: pkg.Dir,
GoFiles: append(pkg.GoFiles, pkg.TestGoFiles...),
Imports: append(pkg.Imports, pkg.TestImports...),
},
IsTest: true,
JSFiles: pkg.JSFiles,
}
}
}