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 5package goproxytest_test 6 7import ( 8 "path/filepath" 9 "testing" 10 11 "github.com/rogpeppe/go-internal/goproxytest" 12 "github.com/rogpeppe/go-internal/gotooltest" 13 "github.com/rogpeppe/go-internal/testscript" 14) 15 16func TestScripts(t *testing.T) { 17 srv, err := goproxytest.NewServer(filepath.Join("testdata", "mod"), "") 18 if err != nil { 19 t.Fatalf("cannot start proxy: %v", err) 20 } 21 p := testscript.Params{ 22 Dir: "testdata", 23 Setup: func(e *testscript.Env) error { 24 e.Vars = append(e.Vars, 25 "GOPROXY="+srv.URL, 26 "GONOSUMDB=*", 27 ) 28 return nil 29 }, 30 } 31 if err := gotooltest.Setup(&p); err != nil { 32 t.Fatal(err) 33 } 34 testscript.Run(t, p) 35} 36