-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmain_test.go
More file actions
36 lines (31 loc) · 721 Bytes
/
main_test.go
File metadata and controls
36 lines (31 loc) · 721 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
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) {
testscript.Main(m, map[string]func(){
"unparam": main,
})
}
var update = flag.Bool("u", false, "update testscripts")
func TestScript(t *testing.T) {
t.Parallel()
p := testscript.Params{
Dir: filepath.Join("testdata", "script"),
RequireExplicitExec: true,
UpdateScripts: *update,
Setup: func(env *testscript.Env) error {
env.Vars = append(env.Vars, "/="+string(os.PathSeparator))
return nil
},
}
if err := gotooltest.Setup(&p); err != nil {
t.Fatal(err)
}
testscript.Run(t, p)
}