@@ -19,6 +19,7 @@ import (
19
19
"testing"
20
20
21
21
"github.com/arduino/arduino-cli/internal/integrationtest"
22
+ "github.com/arduino/go-paths-helper"
22
23
"github.com/stretchr/testify/require"
23
24
)
24
25
@@ -229,3 +230,30 @@ func TestCoreCompletion(t *testing.T) {
229
230
stdout , _ , _ = cli .Run ("__complete" , "upload" , "-P" , "" )
230
231
require .Contains (t , string (stdout ), "atmel_ice" )
231
232
}
233
+
234
+ func TestProfileCompletion (t * testing.T ) {
235
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
236
+ defer env .CleanUp ()
237
+
238
+ // Create test sketches
239
+ sketchWithProfilesPath , err := paths .New ("testdata" , "SketchWithProfiles" ).Abs ()
240
+ require .NoError (t , err )
241
+ require .True (t , sketchWithProfilesPath .IsDir ())
242
+
243
+ stdout , _ , _ := cli .Run ("__complete" , "compile" , sketchWithProfilesPath .String (), "--profile" , "" )
244
+ require .Contains (t , string (stdout ), "profile1" )
245
+ stdout , _ , _ = cli .Run ("__complete" , "monitor" , sketchWithProfilesPath .String (), "--profile" , "" )
246
+ require .Contains (t , string (stdout ), "profile1" )
247
+ stdout , _ , _ = cli .Run ("__complete" , "upload" , sketchWithProfilesPath .String (), "--profile" , "" )
248
+ require .Contains (t , string (stdout ), "profile1" )
249
+
250
+ // The cli is running in the sketch folder, so need the explictly specify the path in the cli
251
+ cli .SetWorkingDir (sketchWithProfilesPath )
252
+ stdout , _ , _ = cli .Run ("__complete" , "compile" , "--profile" , "" )
253
+ require .Contains (t , string (stdout ), "profile1" )
254
+ stdout , _ , _ = cli .Run ("__complete" , "monitor" , "--profile" , "" )
255
+ require .Contains (t , string (stdout ), "profile1" )
256
+ stdout , _ , _ = cli .Run ("__complete" , "upload" , "--profile" , "" )
257
+ require .Contains (t , string (stdout ), "profile1" )
258
+
259
+ }
0 commit comments