@@ -765,3 +765,29 @@ func TestCoreListDeprecatedPlatformWithInstalledJson(t *testing.T) {
765765 requirejson .Len (t , stdout , 1 )
766766 requirejson .Query (t , stdout , ".[] | .deprecated" , "true" )
767767}
768+
769+ func TestCoreListPlatformWithoutPlatformTxt (t * testing.T ) {
770+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
771+ defer env .CleanUp ()
772+
773+ _ , _ , err := cli .Run ("update" )
774+ require .NoError (t , err )
775+
776+ stdout , _ , err := cli .Run ("core" , "list" , "--format" , "json" )
777+ require .NoError (t , err )
778+ requirejson .Len (t , stdout , 0 )
779+
780+ // Simulates creation of a new core in the sketchbook hardware folder
781+ // without a platforms.txt
782+ testBoardsTxt := paths .New (".." , "testdata" , "boards.local.txt" )
783+ boardsTxt := cli .SketchbookDir ().Join ("hardware" , "some-packager" , "some-arch" , "boards.txt" )
784+ require .NoError (t , boardsTxt .Parent ().MkdirAll ())
785+ require .NoError (t , testBoardsTxt .CopyTo (boardsTxt ))
786+
787+ // Verifies no core is installed
788+ stdout , _ , err = cli .Run ("core" , "list" , "--format" , "json" )
789+ require .NoError (t , err )
790+ requirejson .Len (t , stdout , 1 )
791+ requirejson .Query (t , stdout , ".[] | .id" , "\" some-packager:some-arch\" " )
792+ requirejson .Query (t , stdout , ".[] | .name" , "\" some-packager-some-arch\" " )
793+ }
0 commit comments