| 1 |
// Copyright 2021 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 buildcfg |
| 6 |
|
| 7 |
import ( |
| 8 |
"os" |
| 9 |
"testing" |
| 10 |
) |
| 11 |
|
| 12 |
func TestConfigFlags(t *testing.T) { |
| 13 |
os.Setenv("GOAMD64", "v1") |
| 14 |
if goamd64() != 1 { |
| 15 |
t.Errorf("Wrong parsing of GOAMD64=v1") |
| 16 |
} |
| 17 |
os.Setenv("GOAMD64", "v4") |
| 18 |
if goamd64() != 4 { |
| 19 |
t.Errorf("Wrong parsing of GOAMD64=v4") |
| 20 |
} |
| 21 |
Error = nil |
| 22 |
os.Setenv("GOAMD64", "1") |
| 23 |
if goamd64(); Error == nil { |
| 24 |
t.Errorf("Wrong parsing of GOAMD64=1") |
| 25 |
} |
| 26 |
} |