golang.org/x/build@v0.0.0-20240506185731-218518f32b70/buildenv/envs_test.go (about) 1 // Copyright 2019 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 buildenv 6 7 import ( 8 "testing" 9 ) 10 11 func TestEnvironmentNextZone(t *testing.T) { 12 env := Environment{ 13 VMZones: []string{"texas", "california", "washington"}, 14 } 15 wantOneOf := []string{"texas", "california", "washington"} 16 got := env.RandomVMZone() 17 if !containsString(got, wantOneOf) { 18 t.Errorf("got=%q; want %v", got, wantOneOf) 19 } 20 } 21 22 func containsString(item string, items []string) bool { 23 for _, s := range items { 24 if item == s { 25 return true 26 } 27 } 28 return false 29 }