@@ -99,3 +99,30 @@ func TestUpdateWithUrlInternalServerError(t *testing.T) {
99
99
require .Error (t , err )
100
100
require .Contains (t , string (stdout ), "Downloading index: test_index.json Server responded with: 500 Internal Server Error" )
101
101
}
102
+
103
+ func TestUpdateShowingOutdatedUsingLibraryWithInvalidVersion (t * testing.T ) {
104
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
105
+ defer env .CleanUp ()
106
+
107
+ _ , _ , err := cli .Run ("update" )
108
+ require .NoError (t , err )
109
+
110
+ // Install latest version of a library
111
+ _ , _ , err = cli .Run ("lib" , "install" , "WiFi101" )
112
+ require .NoError (t , err )
113
+
114
+ // Verifies library doesn't get updated
115
+ stdout , _ , err := cli .Run ("update" , "--show-outdated" )
116
+ require .NoError (t , err )
117
+ require .NotContains (t , string (stdout ), "WiFi101" )
118
+
119
+ // Changes the version of the currently installed library so that it's
120
+ // invalid
121
+ libPath := cli .SketchbookDir ().Join ("libraries" , "WiFi101" , "library.properties" )
122
+ require .NoError (t , libPath .WriteFile ([]byte ("name=WiFi101\n version=1.0001" )))
123
+
124
+ // Verifies library gets updated
125
+ stdout , _ , err = cli .Run ("update" , "--show-outdated" )
126
+ require .NoError (t , err )
127
+ require .Contains (t , string (stdout ), "WiFi101" )
128
+ }
0 commit comments