@@ -19,7 +19,6 @@ import (
19
19
"encoding/json"
20
20
"fmt"
21
21
"os"
22
- "path/filepath"
23
22
"runtime"
24
23
"sort"
25
24
"strconv"
@@ -52,12 +51,16 @@ func TestCorrectHandlingOfPlatformVersionProperty(t *testing.T) {
52
51
"platforms": [
53
52
{
54
53
"id":"DxCore-dev:megaavr",
54
+ "manually_installed": true,
55
55
"installed_version":"1.4.10",
56
56
"releases": {
57
- "1.4.10 ": {
57
+ "": {
58
58
"name":"DxCore"
59
59
}
60
- }
60
+ },
61
+ "installed_version": "",
62
+ "latest_version": "",
63
+ "has_manually_installed_release": true
61
64
}
62
65
]
63
66
}` )
@@ -512,63 +515,9 @@ func TestCoreListAllManuallyInstalledCore(t *testing.T) {
512
515
requirejson .Contains (t , stdout , `{"platforms":[
513
516
{
514
517
"id": "arduino-beta-development:avr",
515
- "latest_version": "1.8.3 ",
518
+ "latest_version": "",
516
519
"releases": {
517
- "1.8.3": {
518
- "name": "Arduino AVR Boards"
519
- }
520
- }
521
- }
522
- ]}` )
523
- }
524
-
525
- func TestCoreListShowsLatestVersionWhenMultipleReleasesOfAManuallyInstalledCoreArePresent (t * testing.T ) {
526
- env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
527
- defer env .CleanUp ()
528
-
529
- _ , _ , err := cli .Run ("core" , "update-index" )
530
- require .NoError (t , err )
531
-
532
- // Verifies only cores in board manager are shown
533
- stdout , _ , err := cli .Run ("core" , "list" , "--all" , "--json" )
534
- require .NoError (t , err )
535
- requirejson .Query (t , stdout , `.platforms | length > 0` , `true` )
536
- length , err := strconv .Atoi (requirejson .Parse (t , stdout ).Query (".platforms | length" ).String ())
537
- require .NoError (t , err )
538
-
539
- // Manually installs a core in sketchbooks hardware folder
540
- gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
541
- repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "avr" )
542
- _ , err = git .PlainClone (filepath .Join (repoDir .String (), "1.8.3" ), false , & git.CloneOptions {
543
- URL : gitUrl ,
544
- ReferenceName : plumbing .NewTagReferenceName ("1.8.3" ),
545
- })
546
- require .NoError (t , err )
547
-
548
- tmp := paths .New (t .TempDir (), "1.8.4" )
549
- _ , err = git .PlainClone (tmp .String (), false , & git.CloneOptions {
550
- URL : gitUrl ,
551
- ReferenceName : plumbing .NewTagReferenceName ("1.8.4" ),
552
- })
553
- require .NoError (t , err )
554
-
555
- err = tmp .Rename (repoDir .Join ("1.8.4" ))
556
- require .NoError (t , err )
557
-
558
- // When manually installing 2 releases of the same core, the newest one takes precedence
559
- stdout , _ , err = cli .Run ("core" , "list" , "--all" , "--json" )
560
- require .NoError (t , err )
561
- requirejson .Query (t , stdout , `.platforms | length` , fmt .Sprint (length + 1 ))
562
- requirejson .Contains (t , stdout , `{"platforms":[
563
- {
564
- "id": "arduino-beta-development:avr",
565
- "latest_version": "1.8.4",
566
- "installed_version": "1.8.4",
567
- "releases": {
568
- "1.8.3": {
569
- "name": "Arduino AVR Boards"
570
- },
571
- "1.8.3": {
520
+ "": {
572
521
"name": "Arduino AVR Boards"
573
522
}
574
523
}
@@ -606,12 +555,15 @@ func TestCoreListUpdatableAllFlags(t *testing.T) {
606
555
requirejson .Contains (t , stdout , `{"platforms":[
607
556
{
608
557
"id": "arduino-beta-development:avr",
609
- "latest_version": "1.8.3",
558
+ "manually_installed": true,
559
+ "installed_version": "",
560
+ "latest_version": "",
610
561
"releases": {
611
- "1.8.3 ": {
562
+ "": {
612
563
"name": "Arduino AVR Boards"
613
564
}
614
- }
565
+ },
566
+ "has_manually_installed_release": true
615
567
}
616
568
]}` )
617
569
}
@@ -1009,7 +961,7 @@ func TestCoreWithMissingCustomBoardOptionsIsLoaded(t *testing.T) {
1009
961
{
1010
962
"id": "arduino-beta-dev:platform_with_missing_custom_board_options",
1011
963
"releases": {
1012
- "4.2.0 ": {
964
+ "": {
1013
965
"boards": [
1014
966
{
1015
967
"fqbn": "arduino-beta-dev:platform_with_missing_custom_board_options:nessuno"
@@ -1396,10 +1348,10 @@ func TestCoreOverrideIfInstalledInSketchbook(t *testing.T) {
1396
1348
require .NoError (t , err )
1397
1349
1398
1350
// 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))
1351
+ avrCore := cli .DataDir ().Join ("packages" , "arduino" , "hardware" , "avr" , "1.8.5" )
1352
+ avrCoreCopy := cli .SketchbookDir ().Join ("hardware" , "arduino" , "avr" )
1353
+ require .NoError (t , avrCoreCopy .Parent ().MkdirAll ())
1354
+ require .NoError (t , avrCore .CopyDirTo (avrCoreCopy ))
1403
1355
1404
1356
1405
1357
_ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
@@ -1408,5 +1360,25 @@ func TestCoreOverrideIfInstalledInSketchbook(t *testing.T) {
1408
1360
// List cores and check that version 1.8.5 is listed
1409
1361
stdout , _ , err := cli .Run ("core" , "list" , "--json" )
1410
1362
require .NoError (t , err )
1411
- requirejson .Query (t , stdout , `.platforms.[] | select(.id=="arduino:avr") | .installed_version` , `"1.8.5"` )
1363
+ requirejson .Contains (t , stdout , `{
1364
+ "platforms": [
1365
+ {
1366
+ "id": "arduino:avr",
1367
+ "indexed": true,
1368
+ "releases" : {
1369
+ "": {
1370
+ "name": "Arduino AVR Boards",
1371
+ "installed": true
1372
+ },
1373
+ "1.8.6": {
1374
+ "name": "Arduino AVR Boards",
1375
+ "installed": true
1376
+ }
1377
+ },
1378
+ "installed_version": "1.8.6",
1379
+ "latest_version": "1.8.6",
1380
+ "has_manually_installed_release": true
1381
+ }
1382
+ ]
1383
+ }` )
1412
1384
}
0 commit comments