File tree 2 files changed +18
-4
lines changed
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) {
65
65
}
66
66
67
67
libs := res .GetInstalledLibrary ()
68
- feedback .PrintResult (installedResult {libs })
69
68
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 })
70
76
logrus .Info ("Done" )
71
77
}
72
78
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def test_list(run_command):
27
27
result = run_command ("lib list --format json" )
28
28
assert result .ok
29
29
assert "" == result .stderr
30
- assert "null" == result .stdout
30
+ assert 0 == len ( json . loads ( result .stdout ))
31
31
32
32
# Install something we can list at a version older than latest
33
33
result = run_command ("lib install ArduinoJson@6.11.0" )
@@ -70,13 +70,21 @@ def test_update_index(run_command):
70
70
)
71
71
72
72
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"' ]
75
75
assert run_command ("lib install {}" .format (" " .join (libs )))
76
76
77
77
result = run_command ("lib uninstall {}" .format (" " .join (libs )))
78
78
assert result .ok
79
79
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
+
80
88
81
89
def test_search (run_command ):
82
90
assert run_command ("lib update-index" )
You can’t perform that action at this time.
0 commit comments