@@ -1366,3 +1366,30 @@ func TestCoreInstallWithWrongArchiveSize(t *testing.T) {
1366
1366
_ ,
_ ,
err = cli .
Run (
"--additional-urls" ,
"https://raw.githubusercontent.com/geolink/opentracker-arduino-board/bf6158ebab0402db217bfb02ea61461ddc6f2940/package_opentracker_index.json" ,
"core" ,
"install" ,
"opentracker:[email protected] " )
1367
1367
require .NoError (t , err )
1368
1368
}
1369
+
1370
+ func TestCoreOverrideIfInstalledInSketchbook (t * testing.T ) {
1371
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1372
+ defer env .CleanUp ()
1373
+
1374
+ _ , _ , err := cli .Run ("core" , "update-index" )
1375
+ require .NoError (t , err )
1376
+
1377
+
1378
+ _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
1379
+ require .NoError (t , err )
1380
+
1381
+ // Copy it in the sketchbook hardware folder (simulate a user installed core)
1382
+ // avrCore := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.5")
1383
+ // avrCoreCopy := cli.SketchbookDir().Join("hardware", "arduino", "avr")
1384
+ // require.NoError(t, avrCoreCopy.Parent().MkdirAll())
1385
+ // require.NoError(t, avrCore.CopyDirTo(avrCoreCopy))
1386
+
1387
+
1388
+ _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
1389
+ require .NoError (t , err )
1390
+
1391
+ // List cores and check that version 1.8.5 is listed
1392
+ stdout , _ , err := cli .Run ("core" , "list" , "--json" )
1393
+ require .NoError (t , err )
1394
+ requirejson .Query (t , stdout , `.platforms.[] | select(.id=="arduino:avr") | .installed_version` , `"1.8.5"` )
1395
+ }
0 commit comments