@@ -1535,3 +1535,33 @@ func TestLibQueryParameters(t *testing.T) {
15351535 require .Contains (t , string (stdout ),
15361536 "Starting download \x1b [36murl\x1b [0m=\" https://downloads.arduino.cc/libraries/github.com/firmata/Firmata-2.5.9.zip?query=upgrade-builtin\" \n " )
15371537}
1538+
1539+ func TestLibListBundleLibWhenLibWithTheSameNameIsInstalledGlobally (t * testing.T ) {
1540+ // See: https://github.com/arduino/arduino-cli/issues/1566
1541+
1542+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1543+ defer env .CleanUp ()
1544+
1545+ _ , _ , err := cli .Run ("core" , "install" , "arduino:samd" )
1546+ require .NoError (t , err )
1547+
1548+ {
1549+ stdout , _ , err := cli .Run ("lib" , "list" , "--all" , "--fqbn" , "arduino:samd:mkrzero" , "USBHost" , "--format" , "json" )
1550+ require .NoError (t , err )
1551+ j := requirejson .Parse (t , stdout )
1552+ j .Query (`.[0].library.name` ).MustEqual (`"USBHost"` )
1553+ j .Query (`.[0].library.compatible_with."arduino:samd:mkrzero"` ).MustEqual (`true` )
1554+ }
1555+
1556+ _ , _ , err = cli .Run ("lib" , "install" , "USBHost" )
1557+ require .NoError (t , err )
1558+
1559+ {
1560+ // Check that the architecture-specific library is still listed
1561+ stdout , _ , err := cli .Run ("lib" , "list" , "--all" , "--fqbn" , "arduino:samd:mkrzero" , "USBHost" , "--format" , "json" )
1562+ require .NoError (t , err )
1563+ j := requirejson .Parse (t , stdout )
1564+ j .Query (`.[0].library.name` ).MustEqual (`"USBHost"` )
1565+ j .Query (`.[0].library.compatible_with."arduino:samd:mkrzero"` ).MustEqual (`true` )
1566+ }
1567+ }
0 commit comments