golang.org/x/tools@v0.21.0/go/ssa/interp/interp_go122_test.go (about) 1 // Copyright 2023 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 //go:build go1.22 6 // +build go1.22 7 8 package interp_test 9 10 import ( 11 "log" 12 "os" 13 "path/filepath" 14 "testing" 15 16 "golang.org/x/tools/internal/testenv" 17 ) 18 19 func init() { 20 testdataTests = append(testdataTests, 21 "rangevarlifetime_go122.go", 22 "forvarlifetime_go122.go", 23 ) 24 } 25 26 // TestExperimentRange tests files in testdata with GOEXPERIMENT=range set. 27 func TestExperimentRange(t *testing.T) { 28 testenv.NeedsGoExperiment(t, "range") 29 30 // TODO: Is cwd actually needed here? 31 goroot := makeGoroot(t) 32 cwd, err := os.Getwd() 33 if err != nil { 34 log.Fatal(err) 35 } 36 run(t, filepath.Join(cwd, "testdata", "rangeoverint.go"), goroot) 37 }