@@ -22,6 +22,8 @@ import (
22
22
"github.com/arduino/arduino-cli/internal/integrationtest"
23
23
"github.com/stretchr/testify/require"
24
24
"go.bug.st/testifyjson/requirejson"
25
+ "gopkg.in/src-d/go-git.v4"
26
+ "gopkg.in/src-d/go-git.v4/plumbing"
25
27
)
26
28
27
29
func TestBoardList (t * testing.T ) {
@@ -107,3 +109,50 @@ func TestBoardListall(t *testing.T) {
107
109
Query (`[ .boards | .[] | .platform | select(.latest == "") ]` ).
108
110
MustBeEmpty ()
109
111
}
112
+
113
+ func TestBoardListallWithManuallyInstalledPlatform (t * testing.T ) {
114
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
115
+ defer env .CleanUp ()
116
+
117
+ _ , _ , err := cli .Run ("update" )
118
+ require .NoError (t , err )
119
+
120
+ // Manually installs a core in sketchbooks hardware folder
121
+ gitUrl := "https://github.com/arduino/ArduinoCore-samd.git"
122
+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "samd" )
123
+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
124
+ URL : gitUrl ,
125
+ ReferenceName : plumbing .NewTagReferenceName ("1.8.11" ),
126
+ })
127
+ require .NoError (t , err )
128
+
129
+ stdout , _ , err := cli .Run ("board" , "listall" , "--format" , "json" )
130
+ require .NoError (t , err )
131
+
132
+ requirejson .Query (t , stdout , ".boards | length" , "17" )
133
+
134
+ requirejson .Contains (t , stdout , `{
135
+ "boards": [
136
+ {
137
+ "name": "Arduino MKR1000",
138
+ "fqbn": "arduino-beta-development:samd:mkr1000",
139
+ "platform": {
140
+ "id": "arduino-beta-development:samd",
141
+ "installed": "1.8.11",
142
+ "latest": "1.8.11",
143
+ "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
144
+ }
145
+ },
146
+ {
147
+ "name": "Arduino NANO 33 IoT",
148
+ "fqbn": "arduino-beta-development:samd:nano_33_iot",
149
+ "platform": {
150
+ "id": "arduino-beta-development:samd",
151
+ "installed": "1.8.11",
152
+ "latest": "1.8.11",
153
+ "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards"
154
+ }
155
+ }
156
+ ]
157
+ }` )
158
+ }
0 commit comments