File: script_test.go

package info (click to toggle)
golang-github-rogpeppe-go-internal 1.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,220 kB
  • sloc: makefile: 6
file content (36 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (4)
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
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package gotooltest_test

import (
	"os"
	"path/filepath"
	"testing"

	"github.com/rogpeppe/go-internal/gotooltest"
	"github.com/rogpeppe/go-internal/testscript"
)

func TestSimple(t *testing.T) {
	p := testscript.Params{
		Dir: "testdata",
		Setup: func(env *testscript.Env) error {
			// cover.txt will need testscript as a dependency.
			// Tell it where our module is, via an absolute path.
			wd, err := os.Getwd()
			if err != nil {
				return err
			}
			modPath := filepath.Dir(wd)
			env.Setenv("GOINTERNAL_MODULE", modPath)
			return nil
		},
	}

	if err := gotooltest.Setup(&p); err != nil {
		t.Fatal(err)
	}
	testscript.Run(t, p)
}