@@ -42,8 +42,8 @@ func TestDownloadCorrectPlatform(t *testing.T) {
42
42
{"linux" , "arm" , "arm-linux-gnueabihf" },
43
43
}
44
44
defer func () {
45
- OS = runtime .GOOS // restore `runtime.OS`
46
- Arch = runtime .GOARCH // restore `runtime.ARCH`
45
+ pkgs . OS = runtime .GOOS // restore `runtime.OS`
46
+ pkgs . Arch = runtime .GOARCH // restore `runtime.ARCH`
47
47
}()
48
48
testIndex := paths .New ("testdata" , "test_tool_index.json" )
49
49
buf , err := testIndex .ReadFile ()
@@ -54,10 +54,11 @@ func TestDownloadCorrectPlatform(t *testing.T) {
54
54
require .NoError (t , err )
55
55
for _ , tc := range testCases {
56
56
t .Run (tc .hostOS + tc .hostArch , func (t * testing.T ) {
57
- OS = tc .hostOS // override `runtime.OS` for testing purposes
58
- Arch = tc .hostArch // override `runtime.ARCH` for testing purposes
57
+ pkgs . OS = tc .hostOS // override `runtime.OS` for testing purposes
58
+ pkgs . Arch = tc .hostArch // override `runtime.ARCH` for testing purposes
59
59
// Find the tool by name
60
- correctTool , correctSystem := findTool ("arduino-test" , "arduino-fwuploader" , "2.2.2" , data )
60
+ correctTool , correctSystem , found := pkgs .FindTool ("arduino-test" , "arduino-fwuploader" , "2.2.2" , data )
61
+ require .True (t , found )
61
62
require .NotNil (t , correctTool )
62
63
require .NotNil (t , correctSystem )
63
64
require .Equal (t , correctTool .Name , "arduino-fwuploader" )
@@ -78,8 +79,8 @@ func TestDownloadFallbackPlatform(t *testing.T) {
78
79
{"windows" , "amd64" , "i686-mingw32" },
79
80
}
80
81
defer func () {
81
- OS = runtime .GOOS // restore `runtime.OS`
82
- Arch = runtime .GOARCH // restore `runtime.ARCH`
82
+ pkgs . OS = runtime .GOOS // restore `runtime.OS`
83
+ pkgs . Arch = runtime .GOARCH // restore `runtime.ARCH`
83
84
}()
84
85
testIndex := paths .New ("testdata" , "test_tool_index.json" )
85
86
buf , err := testIndex .ReadFile ()
@@ -90,10 +91,11 @@ func TestDownloadFallbackPlatform(t *testing.T) {
90
91
require .NoError (t , err )
91
92
for _ , tc := range testCases {
92
93
t .Run (tc .hostOS + tc .hostArch , func (t * testing.T ) {
93
- OS = tc .hostOS // override `runtime.OS` for testing purposes
94
- Arch = tc .hostArch // override `runtime.ARCH` for testing purposes
94
+ pkgs . OS = tc .hostOS // override `runtime.OS` for testing purposes
95
+ pkgs . Arch = tc .hostArch // override `runtime.ARCH` for testing purposes
95
96
// Find the tool by name
96
- correctTool , correctSystem := findTool ("arduino-test" , "arduino-fwuploader" , "2.2.0" , data )
97
+ correctTool , correctSystem , found := pkgs .FindTool ("arduino-test" , "arduino-fwuploader" , "2.2.0" , data )
98
+ require .True (t , found )
97
99
require .NotNil (t , correctTool )
98
100
require .NotNil (t , correctSystem )
99
101
require .Equal (t , correctTool .Name , "arduino-fwuploader" )
@@ -145,7 +147,7 @@ func TestDownload(t *testing.T) {
145
147
if filePath .IsDir () {
146
148
require .DirExists (t , filePath .String ())
147
149
} else {
148
- if OS == "windows" {
150
+ if runtime . GOOS == "windows" {
149
151
require .FileExists (t , filePath .String ()+ ".exe" )
150
152
} else {
151
153
require .FileExists (t , filePath .String ())
0 commit comments