@@ -1480,3 +1480,36 @@ func TestInstallWithGitUrlLocalFileUri(t *testing.T) {
1480
1480
// Verifies library is installed
1481
1481
require .DirExists (t , libInstallDir .String ())
1482
1482
}
1483
+
1484
+ func TestLibQueryParameters (t * testing.T ) {
1485
+ // This test should not use shared download directory because it needs to download the libraries from scratch
1486
+ env := integrationtest .NewEnvironment (t )
1487
+ cli := integrationtest .NewArduinoCliWithinEnvironment (env , & integrationtest.ArduinoCLIConfig {
1488
+ ArduinoCLIPath : integrationtest .FindArduinoCLIPath (t ),
1489
+ })
1490
+ defer env .CleanUp ()
1491
+
1492
+ // Updates index for cores and libraries
1493
+ _ , _ , err := cli .Run ("core" , "update-index" )
1494
+ require .NoError (t , err )
1495
+ _ , _ , err = cli .Run ("lib" , "update-index" )
1496
+ require .NoError (t , err )
1497
+
1498
+ // Check query=install when a library is installed
1499
+ stdout ,
_ ,
err := cli .
Run (
"lib" ,
"install" ,
"[email protected] " ,
"-v" ,
"--log-level" ,
"debug" )
1500
+ require .NoError (t , err )
1501
+ require .Contains (t , string (stdout ),
1502
+ "Starting download \x1b [36murl\x1b [0m=\" https://downloads.arduino.cc/libraries/github.com/arduino-libraries/USBHost-1.0.0.zip?query=install\" \n " )
1503
+
1504
+ // Check query=upgrade when a library is upgraded
1505
+ stdout , _ , err = cli .Run ("lib" , "upgrade" , "USBHost" , "-v" , "--log-level" , "debug" )
1506
+ require .NoError (t , err )
1507
+ require .Contains (t , string (stdout ),
1508
+ "Starting download \x1b [36murl\x1b [0m=\" https://downloads.arduino.cc/libraries/github.com/arduino-libraries/USBHost-1.0.5.zip?query=upgrade\" \n " )
1509
+
1510
+ // Check query=depends when a library dependency is installed
1511
+ stdout ,
_ ,
err = cli .
Run (
"lib" ,
"install" ,
"[email protected] " ,
"-v" ,
"--log-level" ,
"debug" )
1512
+ require .NoError (t , err )
1513
+ require .Contains (t , string (stdout ),
1514
+ "Starting download \x1b [36murl\x1b [0m=\" https://downloads.arduino.cc/libraries/github.com/MajicDesigns/MD_MAX72XX-3.3.1.zip?query=depends\" \n " )
1515
+ }
0 commit comments