* tree-ssa-reassoc.c (reassociate_bb): Clarify code slighly.
[official-gcc.git] / libgo / go / go / build / syslist_test.go
blob7973ff4ee5f0caee4db24b87def3ed1df01c956b
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.
5 package build
7 import (
8 "runtime"
9 "testing"
12 var (
13 thisOS = runtime.GOOS
14 thisArch = runtime.GOARCH
15 otherOS = anotherOS()
16 otherArch = anotherArch()
19 func anotherOS() string {
20 if thisOS != "darwin" {
21 return "darwin"
23 return "linux"
26 func anotherArch() string {
27 if thisArch != "amd64" {
28 return "amd64"
30 return "386"
33 type GoodFileTest struct {
34 name string
35 result bool
38 var tests = []GoodFileTest{
39 {"file.go", true},
40 {"file.c", true},
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)