@@ -695,7 +695,7 @@ func TestCoreSearchSortedResults(t *testing.T) {
695695 require .NoError (t , err )
696696
697697 out := strings .Split (strings .TrimSpace (string (stdout )), "\n " )
698- var lines , deprecated , notDeprecated , incompatibles [][]string
698+ var lines , deprecated , notDeprecated [][]string
699699 for i , v := range out {
700700 if i > 0 {
701701 v = strings .Join (strings .Fields (v ), " " )
@@ -707,11 +707,7 @@ func TestCoreSearchSortedResults(t *testing.T) {
707707 deprecated = append (deprecated , v )
708708 continue
709709 }
710- if _ , err := semver .Parse (v [1 ]); err != nil {
711- incompatibles = append (incompatibles , v )
712- } else {
713- notDeprecated = append (notDeprecated , v )
714- }
710+ notDeprecated = append (notDeprecated , v )
715711 }
716712
717713 // verify that results are already sorted correctly
@@ -721,13 +717,9 @@ func TestCoreSearchSortedResults(t *testing.T) {
721717 require .True (t , sort .SliceIsSorted (notDeprecated , func (i , j int ) bool {
722718 return strings .ToLower (notDeprecated [i ][2 ]) < strings .ToLower (notDeprecated [j ][2 ])
723719 }))
724- require .True (t , sort .SliceIsSorted (incompatibles , func (i , j int ) bool {
725- return strings .ToLower (incompatibles [i ][2 ]) < strings .ToLower (incompatibles [j ][2 ])
726- }))
727720
728- result := append (notDeprecated , incompatibles ... )
729721 // verify that deprecated platforms are the last ones
730- require .Equal (t , lines , append (result , deprecated ... ))
722+ require .Equal (t , lines , append (notDeprecated , deprecated ... ))
731723
732724 // test same behaviour with json output
733725 stdout , _ , err = cli .Run ("core" , "search" , "--additional-urls=" + url .String (), "--format=json" )
@@ -1134,15 +1126,15 @@ func TestCoreHavingIncompatibleDepTools(t *testing.T) {
11341126 stdout , _ , err := cli .Run ("core" , "list" , "--all" , "--format" , "json" , additionalURLs )
11351127 require .NoError (t , err )
11361128 t .Log (string (stdout ))
1137- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest ` , `"1.0.2"` )
1138- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible ` , `"1.0.1"` )
1129+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_version ` , `"1.0.2"` )
1130+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible_version ` , `"1.0.1"` )
11391131
11401132 // install latest compatible version
11411133 _ , _ , err = cli .Run ("core" , "install" , "foo_vendor:avr" , additionalURLs )
11421134 require .NoError (t , err )
11431135 stdout , _ , err = cli .Run ("core" , "list" , "--all" , "--format" , "json" , additionalURLs )
11441136 require .NoError (t , err )
1145- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible ` , `"1.0.1"` )
1137+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible_version ` , `"1.0.1"` )
11461138
11471139 // install incompatible version
11481140 _ ,
stderr ,
err := cli .
Run (
"core" ,
"install" ,
"foo_vendor:[email protected] " ,
additionalURLs )
@@ -1154,26 +1146,26 @@ func TestCoreHavingIncompatibleDepTools(t *testing.T) {
11541146 require .NoError (t , err )
11551147 stdout , _ , err = cli .Run ("core" , "list" , "--format" , "json" , additionalURLs )
11561148 require .NoError (t , err )
1157- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed ` , `"1.0.0"` )
1149+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed_version ` , `"1.0.0"` )
11581150
11591151 // Lists all updatable cores
11601152 stdout , _ , err = cli .Run ("core" , "list" , "--updatable" , "--format" , "json" , additionalURLs )
11611153 require .NoError (t , err )
1162- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible ` , `"1.0.1"` )
1154+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_compatible_version ` , `"1.0.1"` )
11631155
11641156 // upgrade to latest compatible (1.0.0 -> 1.0.1)
11651157 _ , _ , err = cli .Run ("core" , "upgrade" , "foo_vendor:avr" , "--format" , "json" , additionalURLs )
11661158 require .NoError (t , err )
11671159 stdout , _ , err = cli .Run ("core" , "list" , "--format" , "json" , additionalURLs )
11681160 require .NoError (t , err )
1169- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed ` , `"1.0.1"` )
1161+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed_version ` , `"1.0.1"` )
11701162
11711163 // upgrade to latest incompatible not possible (1.0.1 -> 1.0.2)
11721164 _ , _ , err = cli .Run ("core" , "upgrade" , "foo_vendor:avr" , "--format" , "json" , additionalURLs )
11731165 require .NoError (t , err )
11741166 stdout , _ , err = cli .Run ("core" , "list" , "--format" , "json" , additionalURLs )
11751167 require .NoError (t , err )
1176- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed ` , `"1.0.1"` )
1168+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .installed_version ` , `"1.0.1"` )
11771169
11781170 // When no compatible version are found return error
11791171 _ , stderr , err = cli .Run ("core" , "install" , "incompatible_vendor:avr" , additionalURLs )
@@ -1184,19 +1176,19 @@ func TestCoreHavingIncompatibleDepTools(t *testing.T) {
11841176 stdout , _ , err = cli .Run ("core" , "search" , "--all" , "--format" , "json" , additionalURLs )
11851177 require .NoError (t , err )
11861178 requirejson .Query (t , stdout ,
1187- `[.[] | select(.id == "foo_vendor:avr") | {latest : .latest , incompatible: .incompatible}] | sort_by(.latest )` ,
1179+ `[.[] | select(.id == "foo_vendor:avr") | .releases | map(.) | .[] | {version : .version , incompatible: .incompatible}] | sort_by(.version )` ,
11881180 `[
1189- {"incompatible":null,"latest ":"1.0.0"},
1190- {"incompatible":null,"latest ":"1.0.1"},
1191- {"incompatible":true,"latest ":"1.0.2"}
1181+ {"incompatible":null,"version ":"1.0.0"},
1182+ {"incompatible":null,"version ":"1.0.1"},
1183+ {"incompatible":true,"version ":"1.0.2"}
11921184 ]` ,
11931185 )
11941186
1195- // Core search shows latest compatible version
1187+ // Core search shows latest compatible version even if incompatible
11961188 stdout , _ , err = cli .Run ("core" , "search" , "--format" , "json" , additionalURLs )
11971189 require .NoError (t , err )
1198- requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest ` , `"1.0.1 "` )
1199- requirejson .Query (t , stdout , `.[] | select(.id == "incompatible_vendor:avr") | .incompatible` , `true` )
1190+ requirejson .Query (t , stdout , `.[] | select(.id == "foo_vendor:avr") | .latest_version ` , `"1.0.2 "` )
1191+ requirejson .Query (t , stdout , `.[] | select(.id == "incompatible_vendor:avr") | .releases[.latest_version]. incompatible` , `true` )
12001192
12011193 // In text mode, core search doesn't show any version if no compatible one are present
12021194 stdout , _ , err = cli .Run ("core" , "search" , additionalURLs )
@@ -1205,5 +1197,5 @@ func TestCoreHavingIncompatibleDepTools(t *testing.T) {
12051197 for _ , v := range strings .Split (strings .TrimSpace (string (stdout )), "\n " ) {
12061198 lines = append (lines , strings .Fields (strings .TrimSpace (v )))
12071199 }
1208- require .Contains (t , lines , []string {"incompatible_vendor:avr" , "Incompatible" , "Boards" })
1200+ require .Contains (t , lines , []string {"incompatible_vendor:avr" })
12091201}
0 commit comments