-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
37 lines (31 loc) · 769 Bytes
/
main_test.go
File metadata and controls
37 lines (31 loc) · 769 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
37
package main
import (
"flag"
"os"
"path/filepath"
"testing"
"github.com/rogpeppe/go-internal/gotooltest"
"github.com/rogpeppe/go-internal/testscript"
)
func TestMain(m *testing.M) {
os.Exit(testscript.RunMain(m, map[string]func() int{
"cover": main1,
}))
}
var update = flag.Bool("u", false, "update testscript files")
func TestScript(t *testing.T) {
p := testscript.Params{
Dir: "testdata",
TestWork: true,
UpdateScripts: *update,
Cmds: map[string]func(ts *testscript.TestScript, neg bool, args []string){},
Setup: func(env *testscript.Env) error {
env.Setenv("HOME", filepath.Join(env.WorkDir, "home"))
return nil
},
}
if err := gotooltest.Setup(&p); err != nil {
t.Fatal(err)
}
testscript.Run(t, p)
}