File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,14 @@ func runListCommand(cmd *cobra.Command, args []string) {
6565 }
6666
6767 libs := res .GetInstalledLibrary ()
68- feedback .PrintResult (installedResult {libs })
6968
69+ // To uniform the output to other commands, when there are no result
70+ // print out an empty slice.
71+ if libs == nil {
72+ libs = []* rpc.InstalledLibrary {}
73+ }
74+
75+ feedback .PrintResult (installedResult {libs })
7076 logrus .Info ("Done" )
7177}
7278
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def test_list(run_command):
2727 result = run_command ("lib list --format json" )
2828 assert result .ok
2929 assert "" == result .stderr
30- assert "null" == result .stdout
30+ assert 0 == len ( json . loads ( result .stdout ))
3131
3232 # Install something we can list at a version older than latest
3333 result = run_command ("lib install ArduinoJson@6.11.0" )
@@ -70,13 +70,21 @@ def test_update_index(run_command):
7070 )
7171
7272
73- def test_remove (run_command ):
74- libs = ['"AzureIoTProtocol_MQTT"' , '"CMMC MQTT Connector"' , '" WiFiNINA"' ]
73+ def test_uninstall (run_command ):
74+ libs = ['"AzureIoTProtocol_MQTT"' , '"WiFiNINA"' ]
7575 assert run_command ("lib install {}" .format (" " .join (libs )))
7676
7777 result = run_command ("lib uninstall {}" .format (" " .join (libs )))
7878 assert result .ok
7979
80+ def test_uninstall_spaces (run_command ):
81+ key = '"LiquidCrystal I2C"'
82+ assert run_command ("lib install {}" .format (key ))
83+ assert run_command ("lib uninstall {}" .format (key ))
84+ result = run_command ("lib list --format json" )
85+ assert result .ok
86+ assert len (json .loads (result .stdout )) == 0
87+
8088
8189def test_search (run_command ):
8290 assert run_command ("lib update-index" )
You can’t perform that action at this time.
0 commit comments