@@ -43,9 +43,8 @@ func TestPlatformSearch(t *testing.T) {
4343
4444 t .Run ("SearchAllVersions" , func (t * testing.T ) {
4545 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
46- Instance : inst ,
47- SearchArgs : "retrokit" ,
48- AllVersions : true ,
46+ Instance : inst ,
47+ SearchArgs : "retrokit" ,
4948 })
5049 require .Nil (t , stat )
5150 require .NotNil (t , res )
@@ -80,48 +79,13 @@ func TestPlatformSearch(t *testing.T) {
8079 },
8180 },
8281 InstalledVersion : "" ,
83- LatestVersion : "1.0.6" ,
84- })
85- })
86-
87- t .Run ("SearchNoAllVersions" , func (t * testing.T ) {
88- res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
89- Instance : inst ,
90- SearchArgs : "retrokit" ,
91- AllVersions : false ,
92- })
93- require .Nil (t , stat )
94- require .NotNil (t , res )
95- require .Len (t , res .SearchOutput , 1 )
96- require .Contains (t , res .SearchOutput , & rpc.PlatformSummary {
97- Metadata : & rpc.PlatformMetadata {
98- Id : "Retrokits-RK002:arm" ,
99- Maintainer : "Retrokits (www.retrokits.com)" ,
100- Website : "https://www.retrokits.com" ,
101- 102- Indexed : true ,
103- },
104- Releases : map [string ]* rpc.PlatformRelease {
105- "1.0.6" : {
106- Name : "RK002" ,
107- Type : []string {"Contributed" },
108- Installed : false ,
109- Version : "1.0.6" ,
110- Boards : []* rpc.Board {{Name : "RK002" }},
111- Help : & rpc.HelpResources {Online : "https://www.retrokits.com/rk002/arduino" },
112- Compatible : false ,
113- },
114- },
115- InstalledVersion : "" ,
116- LatestVersion : "1.0.6" ,
11782 })
11883 })
11984
12085 t .Run ("SearchThePackageMaintainer" , func (t * testing.T ) {
12186 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
122- Instance : inst ,
123- SearchArgs : "Retrokits (www.retrokits.com)" ,
124- AllVersions : true ,
87+ Instance : inst ,
88+ SearchArgs : "Retrokits (www.retrokits.com)" ,
12589 })
12690 require .Nil (t , stat )
12791 require .NotNil (t , res )
@@ -155,15 +119,13 @@ func TestPlatformSearch(t *testing.T) {
155119 },
156120 },
157121 InstalledVersion : "" ,
158- LatestVersion : "1.0.6" ,
159122 })
160123 })
161124
162125 t .Run ("SearchPackageName" , func (t * testing.T ) {
163126 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
164- Instance : inst ,
165- SearchArgs : "Retrokits-RK002" ,
166- AllVersions : true ,
127+ Instance : inst ,
128+ SearchArgs : "Retrokits-RK002" ,
167129 })
168130 require .Nil (t , stat )
169131 require .NotNil (t , res )
@@ -197,15 +159,13 @@ func TestPlatformSearch(t *testing.T) {
197159 },
198160 },
199161 InstalledVersion : "" ,
200- LatestVersion : "1.0.6" ,
201162 })
202163 })
203164
204165 t .Run ("SearchPlatformName" , func (t * testing.T ) {
205166 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
206- Instance : inst ,
207- SearchArgs : "rk002" ,
208- AllVersions : true ,
167+ Instance : inst ,
168+ SearchArgs : "rk002" ,
209169 })
210170 require .Nil (t , stat )
211171 require .NotNil (t , res )
@@ -239,15 +199,13 @@ func TestPlatformSearch(t *testing.T) {
239199 },
240200 },
241201 InstalledVersion : "" ,
242- LatestVersion : "1.0.6" ,
243202 })
244203 })
245204
246205 t .Run ("SearchBoardName" , func (t * testing.T ) {
247206 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
248- Instance : inst ,
249- SearchArgs : "Yún" ,
250- AllVersions : true ,
207+ Instance : inst ,
208+ SearchArgs : "Yún" ,
251209 })
252210 require .Nil (t , stat )
253211 require .NotNil (t , res )
@@ -299,15 +257,13 @@ func TestPlatformSearch(t *testing.T) {
299257 },
300258 },
301259 InstalledVersion : "" ,
302- LatestVersion : "1.8.3" ,
303260 })
304261 })
305262
306263 t .Run ("SearchBoardName2" , func (t * testing.T ) {
307264 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
308- Instance : inst ,
309- SearchArgs : "yun" ,
310- AllVersions : true ,
265+ Instance : inst ,
266+ SearchArgs : "yun" ,
311267 })
312268 require .Nil (t , stat )
313269 require .NotNil (t , res )
@@ -359,7 +315,6 @@ func TestPlatformSearch(t *testing.T) {
359315 },
360316 },
361317 InstalledVersion : "" ,
362- LatestVersion : "1.8.3" ,
363318 })
364319 })
365320}
@@ -381,17 +336,16 @@ func TestPlatformSearchSorting(t *testing.T) {
381336 require .NotNil (t , inst )
382337
383338 res , stat := PlatformSearch (& rpc.PlatformSearchRequest {
384- Instance : inst ,
385- SearchArgs : "" ,
386- AllVersions : false ,
339+ Instance : inst ,
340+ SearchArgs : "" ,
387341 })
388342 require .Nil (t , stat )
389343 require .NotNil (t , res )
390344
391345 require .Len (t , res .SearchOutput , 3 )
392- require .Equal (t , res .SearchOutput [0 ].GetLatestRelease () .Name , "Arduino AVR Boards" )
346+ require .Equal (t , res .SearchOutput [0 ].GetSortedReleases ()[ 0 ] .Name , "Arduino AVR Boards" )
393347 require .Equal (t , res .SearchOutput [0 ].Metadata .Deprecated , false )
394- require .Equal (t , res .SearchOutput [1 ].GetLatestRelease () .Name , "RK002" )
348+ require .Equal (t , res .SearchOutput [1 ].GetSortedReleases ()[ 0 ] .Name , "RK002" )
395349 require .Equal (t , res .SearchOutput [1 ].Metadata .Deprecated , false )
396350 require .Equal (t , res .SearchOutput [2 ].GetLatestRelease ().Name , "Platform" )
397351 require .Equal (t , res .SearchOutput [2 ].Metadata .Deprecated , true )
0 commit comments