Debian Codegraph @

gotooltest/script_test.go

raw symbols SCIP
1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package gotooltest_test
6
7 import (
8 "os"
9 "path/filepath"
10 "testing"
11
12 "github.com/rogpeppe/go-internal/gotooltest"
13 "github.com/rogpeppe/go-internal/testscript"
14 )
15
16 func TestSimple(t *testing.T) {
17 p := testscript.Params{
18 Dir: "testdata",
19 Setup: func(env *testscript.Env) error {
20 // cover.txt will need testscript as a dependency.
21 // Tell it where our module is, via an absolute path.
22 wd, err := os.Getwd()
23 if err != nil {
24 return err
25 }
26 modPath := filepath.Dir(wd)
27 env.Setenv("GOINTERNAL_MODULE", modPath)
28 return nil
29 },
30 }
31
32 if err := gotooltest.Setup(&p); err != nil {
33 t.Fatal(err)
34 }
35 testscript.Run(t, p)
36 }