@@ -213,3 +213,32 @@ func TestConfigCompletion(t *testing.T) {
213
213
stdout , _ , _ = cli .Run ("__complete" , "config" , "set" , "" )
214
214
require .Contains (t , string (stdout ), "board_manager.additional_urls" )
215
215
}
216
+
217
+ // here we test if the completions coming from the libs are working
218
+ func TestLibCompletion (t * testing.T ) {
219
+ env := testsuite .NewEnvironment (t )
220
+ defer env .CleanUp ()
221
+
222
+ cli := integrationtest .NewArduinoCliWithinEnvironment (env , & integrationtest.ArduinoCLIConfig {
223
+ ArduinoCLIPath : paths .New (".." , ".." , ".." , "arduino-cli" ),
224
+ UseSharedStagingFolder : true ,
225
+ })
226
+
227
+ _ , _ , err := cli .Run ("lib" , "update-index" )
228
+ require .NoError (t , err )
229
+ stdout , _ , _ := cli .Run ("__complete" , "lib" , "install" , "" )
230
+ require .Contains (t , string (stdout ), "WiFi101" )
231
+ stdout , _ , _ = cli .Run ("__complete" , "lib" , "download" , "" )
232
+ require .Contains (t , string (stdout ), "WiFi101" )
233
+ stdout , _ , _ = cli .Run ("__complete" , "lib" , "uninstall" , "" )
234
+ require .NotContains (t , string (stdout ), "WiFi101" ) // not yet installed
235
+
236
+ _ , _ , err = cli .Run ("lib" , "install" , "Wifi101" )
237
+ require .NoError (t , err )
238
+ stdout , _ , _ = cli .Run ("__complete" , "lib" , "uninstall" , "" )
239
+ require .Contains (t , string (stdout ), "WiFi101" )
240
+ stdout , _ , _ = cli .Run ("__complete" , "lib" , "examples" , "" )
241
+ require .Contains (t , string (stdout ), "WiFi101" )
242
+ stdout , _ , _ = cli .Run ("__complete" , "lib" , "deps" , "" )
243
+ require .Contains (t , string (stdout ), "WiFi101" )
244
+ }
0 commit comments