@@ -42,8 +42,8 @@ func TestDownloadCorrectPlatform(t *testing.T) {
4242 {"linux" , "arm" , "arm-linux-gnueabihf" },
4343 }
4444 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`
4747 }()
4848 testIndex := paths .New ("testdata" , "test_tool_index.json" )
4949 buf , err := testIndex .ReadFile ()
@@ -54,10 +54,11 @@ func TestDownloadCorrectPlatform(t *testing.T) {
5454 require .NoError (t , err )
5555 for _ , tc := range testCases {
5656 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
5959 // 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 )
6162 require .NotNil (t , correctTool )
6263 require .NotNil (t , correctSystem )
6364 require .Equal (t , correctTool .Name , "arduino-fwuploader" )
@@ -78,8 +79,8 @@ func TestDownloadFallbackPlatform(t *testing.T) {
7879 {"windows" , "amd64" , "i686-mingw32" },
7980 }
8081 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`
8384 }()
8485 testIndex := paths .New ("testdata" , "test_tool_index.json" )
8586 buf , err := testIndex .ReadFile ()
@@ -90,10 +91,11 @@ func TestDownloadFallbackPlatform(t *testing.T) {
9091 require .NoError (t , err )
9192 for _ , tc := range testCases {
9293 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
9596 // 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 )
9799 require .NotNil (t , correctTool )
98100 require .NotNil (t , correctSystem )
99101 require .Equal (t , correctTool .Name , "arduino-fwuploader" )
@@ -145,7 +147,7 @@ func TestDownload(t *testing.T) {
145147 if filePath .IsDir () {
146148 require .DirExists (t , filePath .String ())
147149 } else {
148- if OS == "windows" {
150+ if runtime . GOOS == "windows" {
149151 require .FileExists (t , filePath .String ()+ ".exe" )
150152 } else {
151153 require .FileExists (t , filePath .String ())
0 commit comments