@@ -127,3 +127,30 @@ func TestUpdateWithUrlInternalServerError(t *testing.T) {
127
127
require .Error (t , err )
128
128
require .Contains (t , string (stdout ), "Downloading index: test_index.json Server responded with: 500 Internal Server Error" )
129
129
}
130
+
131
+ func TestUpdateShowingOutdatedUsingLibraryWithInvalidVersion (t * testing.T ) {
132
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
133
+ defer env .CleanUp ()
134
+
135
+ _ , _ , err := cli .Run ("update" )
136
+ require .NoError (t , err )
137
+
138
+ // Install latest version of a library
139
+ _ , _ , err = cli .Run ("lib" , "install" , "WiFi101" )
140
+ require .NoError (t , err )
141
+
142
+ // Verifies library doesn't get updated
143
+ stdout , _ , err := cli .Run ("update" , "--show-outdated" )
144
+ require .NoError (t , err )
145
+ require .NotContains (t , string (stdout ), "WiFi101" )
146
+
147
+ // Changes the version of the currently installed library so that it's
148
+ // invalid
149
+ libPath := cli .SketchbookDir ().Join ("libraries" , "WiFi101" , "library.properties" )
150
+ require .NoError (t , libPath .WriteFile ([]byte ("name=WiFi101\n version=1.0001" )))
151
+
152
+ // Verifies library gets updated
153
+ stdout , _ , err = cli .Run ("update" , "--show-outdated" )
154
+ require .NoError (t , err )
155
+ require .Contains (t , string (stdout ), "WiFi101" )
156
+ }
0 commit comments