@@ -230,3 +230,29 @@ func TestCoreInstallWithoutUpdateIndex(t *testing.T) {
230230 require .NoError (t , err )
231231 require .Contains (t , string (stdout ), "Downloading index: package_index.tar.bz2 downloaded" )
232232}
233+
234+ func TestCoreDownload (t * testing.T ) {
235+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
236+ defer env .CleanUp ()
237+
238+ _ , _ , err := cli .Run ("core" , "update-index" )
239+ require .NoError (t , err )
240+
241+ // Download a specific core version
242+ _ , _ , err = cli .Run ("core" , "download" , "arduino:avr@1.6.16" )
243+ require .NoError (t , err )
244+ require .FileExists (t , cli .DownloadDir ().Join ("packages" , "avr-1.6.16.tar.bz2" ).String ())
245+
246+ // Wrong core version
247+ _ , _ , err = cli .Run ("core" , "download" , "arduino:avr@69.42.0" )
248+ require .Error (t , err )
249+
250+ // Wrong core
251+ _ , _ , err = cli .Run ("core" , "download" , "bananas:avr" )
252+ require .Error (t , err )
253+
254+ // Wrong casing
255+ _ , _ , err = cli .Run ("core" , "download" , "Arduino:Samd@1.8.12" )
256+ require .NoError (t , err )
257+ require .FileExists (t , cli .DownloadDir ().Join ("packages" , "core-ArduinoCore-samd-1.8.12.tar.bz2" ).String ())
258+ }
0 commit comments