@@ -453,3 +453,38 @@ func TestCoreListAllManuallyInstalledCore(t *testing.T) {
453453 }
454454 ]` )
455455}
456+
457+ func TestCoreListUpdatableAllFlags (t * testing.T ) {
458+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
459+ defer env .CleanUp ()
460+
461+ _ , _ , err := cli .Run ("core" , "update-index" )
462+ require .NoError (t , err )
463+
464+ // Verifies only cores in board manager are shown
465+ stdout , _ , err := cli .Run ("core" , "list" , "--all" , "--updatable" , "--format" , "json" )
466+ require .NoError (t , err )
467+ requirejson .Query (t , stdout , "length > 0" , "true" )
468+ len , _ := strconv .Atoi (requirejson .Parse (t , stdout ).Query ("length" ).String ())
469+
470+ // Manually installs a core in sketchbooks hardware folder
471+ gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
472+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "avr" )
473+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
474+ URL : gitUrl ,
475+ ReferenceName : plumbing .NewTagReferenceName ("1.8.3" ),
476+ })
477+ require .NoError (t , err )
478+
479+ // Verifies using both --updatable and --all flags --all takes precedence
480+ stdout , _ , err = cli .Run ("core" , "list" , "--all" , "--updatable" , "--format" , "json" )
481+ require .NoError (t , err )
482+ requirejson .Len (t , stdout , len + 1 )
483+ requirejson .Contains (t , stdout , `[
484+ {
485+ "id": "arduino-beta-development:avr",
486+ "latest": "1.8.3",
487+ "name": "Arduino AVR Boards"
488+ }
489+ ]` )
490+ }
0 commit comments