Skip to content

Commit 4789c67

Browse files
committed
Added integration test
1 parent fd1b204 commit 4789c67

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

internal/integrationtest/core/core_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,3 +1383,30 @@ func TestCoreInstallWithMissingOrInvalidChecksumAndUnsafeInstallEnabled(t *testi
13831383
"--additional-urls", "https://raw.githubusercontent.com/keyboardio/ArduinoCore-GD32-Keyboardio/refs/heads/main/package_gd32_index.json", "core", "install", "GD32Community:gd32")
13841384
require.NoError(t, err)
13851385
}
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

Comments
 (0)