@@ -62,3 +62,41 @@ func TestOutdated(t *testing.T) {
62
62
require .Contains (t , lines [1 ], "Arduino AVR Boards" )
63
63
require .Contains (t , lines [4 ], "USBHost" )
64
64
}
65
+
66
+ func TestOutdatedUsingLibraryWithInvalidVersion (t * testing.T ) {
67
+ env := testsuite .NewEnvironment (t )
68
+ defer env .CleanUp ()
69
+
70
+ cli := integrationtest .NewArduinoCliWithinEnvironment (env , & integrationtest.ArduinoCLIConfig {
71
+ ArduinoCLIPath : paths .New (".." , ".." , ".." , "arduino-cli" ),
72
+ UseSharedStagingFolder : true ,
73
+ })
74
+
75
+ _ , _ , err := cli .Run ("update" )
76
+ require .NoError (t , err )
77
+
78
+ // Install latest version of a library library
79
+ _ , _ , err = cli .Run ("lib" , "install" , "WiFi101" )
80
+ require .NoError (t , err )
81
+
82
+ // Verifies library is correctly returned
83
+ stdout , _ , err := cli .Run ("outdated" )
84
+ require .NoError (t , err )
85
+ require .NotContains (t , string (stdout ), "WiFi101" )
86
+
87
+ // Changes the version of the currently installed library so that it's invalid
88
+ libPath := cli .SketchbookDir ().Join ("libraries" , "WiFi101" , "library.properties" )
89
+ err = libPath .WriteFile ([]byte ("name=WiFi101\n version=1.0001" ))
90
+ require .NoError (t , err )
91
+
92
+ // Verifies library is correctly returned
93
+ stdout , _ , err = cli .Run ("outdated" )
94
+ require .NoError (t , err )
95
+ lines := strings .Split (string (stdout ), "\n " )
96
+ l := make ([][]string , len (lines ))
97
+ for i := range lines {
98
+ lines [i ] = strings .TrimSpace (lines [i ])
99
+ l [i ] = strings .Split (lines [i ], " " )
100
+ }
101
+ require .Contains (t , l [1 ][0 ], "WiFi101" )
102
+ }
0 commit comments