1 // Copyright 2011 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.
14 thisArch
= runtime
.GOARCH
16 otherArch
= anotherArch()
19 func anotherOS() string {
20 if thisOS
!= "darwin" {
26 func anotherArch() string {
27 if thisArch
!= "amd64" {
33 type GoodFileTest
struct {
38 var tests
= []GoodFileTest
{
41 {"file_foo.go", true},
42 {"file_" + thisArch
+ ".go", true},
43 {"file_" + otherArch
+ ".go", false},
44 {"file_" + thisOS
+ ".go", true},
45 {"file_" + otherOS
+ ".go", false},
46 {"file_" + thisOS
+ "_" + thisArch
+ ".go", true},
47 {"file_" + otherOS
+ "_" + thisArch
+ ".go", false},
48 {"file_" + thisOS
+ "_" + otherArch
+ ".go", false},
49 {"file_" + otherOS
+ "_" + otherArch
+ ".go", false},
50 {"file_foo_" + thisArch
+ ".go", true},
51 {"file_foo_" + otherArch
+ ".go", false},
52 {"file_" + thisOS
+ ".c", true},
53 {"file_" + otherOS
+ ".c", false},
56 func TestGoodOSArch(t
*testing
.T
) {
57 for _
, test
:= range tests
{
58 if Default
.goodOSArchFile(test
.name
, make(map[string]bool)) != test
.result
{
59 t
.Fatalf("goodOSArchFile(%q) != %v", test
.name
, test
.result
)