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