@@ -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 ) {
@@ -108,3 +110,50 @@ func TestBoardListall(t *testing.T) {
108
110
// Check if the boards' "latest" value is not empty
109
111
requirejson .Query (t , stdout , ".boards | .[] | .platform | .latest != \" \" " , "true" )
110
112
}
113
+
114
+ func TestBoardListallWithManuallyInstalledPlatform (t * testing.T ) {
115
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
116
+ defer env .CleanUp ()
117
+
118
+ _ , _ , err := cli .Run ("update" )
119
+ require .NoError (t , err )
120
+
121
+ // Manually installs a core in sketchbooks hardware folder
122
+ gitUrl := "https://github.com/arduino/ArduinoCore-samd.git"
123
+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "samd" )
124
+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
125
+ URL : gitUrl ,
126
+ ReferenceName : plumbing .NewTagReferenceName ("1.8.11" ),
127
+ })
128
+ require .NoError (t , err )
129
+
130
+ stdout , _ , err := cli .Run ("board" , "listall" , "--format" , "json" )
131
+ require .NoError (t , err )
132
+
133
+ requirejson .Query (t , stdout , ".boards | length" , "17" )
134
+
135
+ requirejson .Contains (t , stdout , `{
136
+ "boards": [
137
+ {
138
+ "name": "Arduino MKR1000",
139
+ "fqbn": "arduino-beta-development:samd:mkr1000",
140
+ "platform": {
141
+ "id": "arduino-beta-development:samd",
142
+ "installed": "1.8.11",
143
+ "latest": "1.8.11",
144
+ "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
145
+ }
146
+ },
147
+ {
148
+ "name": "Arduino NANO 33 IoT",
149
+ "fqbn": "arduino-beta-development:samd:nano_33_iot",
150
+ "platform": {
151
+ "id": "arduino-beta-development:samd",
152
+ "installed": "1.8.11",
153
+ "latest": "1.8.11",
154
+ "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards"
155
+ }
156
+ }
157
+ ]
158
+ }` )
159
+ }
0 commit comments