File tree Expand file tree Collapse file tree 5 files changed +40
-2
lines changed Expand file tree Collapse file tree 5 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 55 - osx
66go :
77 - " 1.11.x"
8+ - " 1.12beta1"
89env :
910 - GO111MODULE=on
1011go_import_path : github.com/rogpeppe/go-internal
Original file line number Diff line number Diff line change 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+ "testing"
9+
10+ "github.com/rogpeppe/go-internal/gotooltest"
11+ "github.com/rogpeppe/go-internal/testscript"
12+ )
13+
14+ func TestSimple (t * testing.T ) {
15+ p := testscript.Params {
16+ Dir : "testdata" ,
17+ }
18+ if err := gotooltest .Setup (& p ); err != nil {
19+ t .Fatal (err )
20+ }
21+ testscript .Run (t , p )
22+ }
Original file line number Diff line number Diff line change @@ -8,15 +8,21 @@ package gotooltest
88
99import (
1010 "fmt"
11+ "go/build"
1112 "os/exec"
1213 "path/filepath"
14+ "regexp"
1315 "runtime"
1416 "strings"
1517
1618 "github.com/rogpeppe/go-internal/imports"
1719 "github.com/rogpeppe/go-internal/testscript"
1820)
1921
22+ var (
23+ goVersionRegex = regexp .MustCompile (`^go([1-9][0-9]*)\.(0|[1-9][0-9]*)$` )
24+ )
25+
2026type testContext struct {
2127 goroot string
2228 gocache string
@@ -56,6 +62,14 @@ func Setup(p *testscript.Params) error {
5662 return false , nil
5763 }
5864 }
65+ if goVersionRegex .MatchString (cond ) {
66+ for _ , v := range build .Default .ReleaseTags {
67+ if cond == v {
68+ return true , nil
69+ }
70+ }
71+ return false , nil
72+ }
5973 if origCondition == nil {
6074 return false , fmt .Errorf ("unknown condition %q" , cond )
6175 }
Original file line number Diff line number Diff line change 1+ go version
2+ [go1.11] [!go1.12] stdout go1\.11
3+ [go1.12] stdout go1\.12
Original file line number Diff line number Diff line change @@ -367,8 +367,6 @@ Script:
367367// condition reports whether the given condition is satisfied.
368368func (ts * TestScript ) condition (cond string ) (bool , error ) {
369369 switch cond {
370- case runtime .GOOS , runtime .GOARCH , runtime .Compiler :
371- return true , nil
372370 case "short" :
373371 return testing .Short (), nil
374372 case "net" :
You can’t perform that action at this time.
0 commit comments