| 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 |
package main |
| 6 |
|
| 7 |
import ( |
| 8 |
"internal/platform" |
| 9 |
"testing" |
| 10 |
) |
| 11 |
|
| 12 |
// TestMustLinkExternal verifies that the mustLinkExternal helper |
| 13 |
// function matches internal/platform.MustLinkExternal. |
| 14 |
func TestMustLinkExternal(t *testing.T) { |
| 15 |
for _, goos := range okgoos { |
| 16 |
for _, goarch := range okgoarch { |
| 17 |
for _, cgoEnabled := range []bool{true, false} { |
| 18 |
got := mustLinkExternal(goos, goarch, cgoEnabled) |
| 19 |
want := platform.MustLinkExternal(goos, goarch, cgoEnabled) |
| 20 |
if got != want { |
| 21 |
t.Errorf("mustLinkExternal(%q, %q, %v) = %v; want %v", goos, goarch, cgoEnabled, got, want) |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
func TestRequiredBootstrapVersion(t *testing.T) { |
| 29 |
testCases := map[string]string{ |
| 30 |
"1.22": "1.20", |
| 31 |
"1.23": "1.20", |
| 32 |
"1.24": "1.22", |
| 33 |
"1.25": "1.22", |
| 34 |
"1.26": "1.24", |
| 35 |
"1.27": "1.24", |
| 36 |
} |
| 37 |
|
| 38 |
for v, want := range testCases { |
| 39 |
if got := requiredBootstrapVersion(v); got != want { |
| 40 |
t.Errorf("requiredBootstrapVersion(%v): got %v, want %v", v, got, want) |
| 41 |
} |
| 42 |
} |
| 43 |
} |