@@ -1383,3 +1383,30 @@ func TestCoreInstallWithMissingOrInvalidChecksumAndUnsafeInstallEnabled(t *testi
1383
1383
"--additional-urls" , "https://raw.githubusercontent.com/keyboardio/ArduinoCore-GD32-Keyboardio/refs/heads/main/package_gd32_index.json" , "core" , "install" , "GD32Community:gd32" )
1384
1384
require .NoError (t , err )
1385
1385
}
1386
+
1387
+ func TestCoreOverrideIfInstalledInSketchbook (t * testing.T ) {
1388
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1389
+ defer env .CleanUp ()
1390
+
1391
+ _ , _ , err := cli .Run ("core" , "update-index" )
1392
+ require .NoError (t , err )
1393
+
1394
+ // Install avr@1.8.5
1395
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.5" )
1396
+ require .NoError (t , err )
1397
+
1398
+ // Copy it in the sketchbook hardware folder (simulate a user installed core)
1399
+ // avrCore := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.5")
1400
+ // avrCoreCopy := cli.SketchbookDir().Join("hardware", "arduino", "avr")
1401
+ // require.NoError(t, avrCoreCopy.Parent().MkdirAll())
1402
+ // require.NoError(t, avrCore.CopyDirTo(avrCoreCopy))
1403
+
1404
+ // Install avr@1.8.6
1405
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.6" )
1406
+ require .NoError (t , err )
1407
+
1408
+ // List cores and check that version 1.8.5 is listed
1409
+ stdout , _ , err := cli .Run ("core" , "list" , "--json" )
1410
+ require .NoError (t , err )
1411
+ requirejson .Query (t , stdout , `.platforms.[] | select(.id=="arduino:avr") | .installed_version` , `"1.8.5"` )
1412
+ }
0 commit comments