This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 356
/
platform_test.go
150 lines (125 loc) · 3.25 KB
/
platform_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package main
import (
"reflect"
"testing"
)
func TestSupportedPlatforms(t *testing.T) {
var ps []Platform
ps = SupportedPlatforms("go1.0")
if !reflect.DeepEqual(ps, Platforms_1_0) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.1")
if !reflect.DeepEqual(ps, Platforms_1_1) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.2")
if !reflect.DeepEqual(ps, Platforms_1_1) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.3")
if !reflect.DeepEqual(ps, Platforms_1_3) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.4")
if !reflect.DeepEqual(ps, Platforms_1_4) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.5")
if !reflect.DeepEqual(ps, Platforms_1_5) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.6")
if !reflect.DeepEqual(ps, Platforms_1_6) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.7")
if !reflect.DeepEqual(ps, Platforms_1_7) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.8")
if !reflect.DeepEqual(ps, Platforms_1_8) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.9")
if !reflect.DeepEqual(ps, Platforms_1_9) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.10")
if !reflect.DeepEqual(ps, Platforms_1_10) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.10")
if !reflect.DeepEqual(ps, Platforms_1_10) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.11")
if !reflect.DeepEqual(ps, Platforms_1_11) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.12")
if !reflect.DeepEqual(ps, Platforms_1_12) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.13")
if !reflect.DeepEqual(ps, Platforms_1_13) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.14")
if !reflect.DeepEqual(ps, Platforms_1_14) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.15")
if !reflect.DeepEqual(ps, Platforms_1_15) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.16")
if !reflect.DeepEqual(ps, Platforms_1_16) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.17")
if !reflect.DeepEqual(ps, Platforms_1_17) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.18")
if !reflect.DeepEqual(ps, Platforms_1_18) {
t.Fatalf("bad: %#v", ps)
}
ps = SupportedPlatforms("go1.10")
if !reflect.DeepEqual(ps, Platforms_1_10) {
t.Fatalf("bad: %#v", ps)
}
// Unknown
ps = SupportedPlatforms("foo")
if !reflect.DeepEqual(ps, PlatformsLatest) {
t.Fatalf("bad: %#v", ps)
}
}
func TestMIPS(t *testing.T) {
g16 := SupportedPlatforms("go1.6")
found := false
for _, p := range g16 {
if p.OS == "linux" && p.Arch == "mips64" && !p.Default {
found = true
}
if p.OS == "linux" && p.Arch == "mips64" && p.Default {
t.Fatalf("mips64 should not be default for 1.6, but got %+v, %+v", p, g16)
}
}
if !found {
t.Fatal("Expected to find linux/mips64/false in go1.6 supported platforms")
}
found = false
g17 := SupportedPlatforms("go1.7")
for _, p := range g17 {
if p.OS == "linux" && p.Arch == "mips64" && p.Default {
found = true
}
if p.OS == "linux" && p.Arch == "mips64" && !p.Default {
t.Fatal("mips64 should be default for 1.7")
}
}
if !found {
t.Fatal("Expected to find linux/mips64/true in go1.7 supported platforms")
}
}