@@ -448,3 +448,49 @@ func TestListWithFqbn(t *testing.T) {
448
448
requirejson .Query (t , stdout , ".[0] | .library | .name" , "\" ArduinoJson\" " )
449
449
requirejson .Query (t , stdout , ".[0] | .library | .compatible_with | .\" arduino:avr:uno\" " , "true" )
450
450
}
451
+
452
+ func TestListProvidesIncludesFallback (t * testing.T ) {
453
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
454
+ defer env .CleanUp ()
455
+
456
+ // Verifies "provides_includes" field is returned even if libraries don't declare
457
+ // the "includes" property in their "library.properties" file
458
+ _ , _ , err := cli .Run ("update" )
459
+ require .NoError (t , err )
460
+
461
+ // Install core
462
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.3" )
463
+ require .NoError (t , err )
464
+ _ , _ , err = cli .Run ("lib" , "install" , "ArduinoJson@6.17.2" )
465
+ require .NoError (t , err )
466
+
467
+ // List all libraries, even the ones installed with the above core
468
+ stdout , stderr , err := cli .Run ("lib" , "list" , "--all" , "--fqbn" , "arduino:avr:uno" , "--format" , "json" )
469
+ require .NoError (t , err )
470
+ require .Empty (t , stderr )
471
+
472
+ requirejson .Len (t , stdout , 6 )
473
+
474
+ requirejson .Query (t , stdout , "[.[] | .library | { (.name): .provides_includes }] | add" ,
475
+ `{
476
+ "SPI": [
477
+ "SPI.h"
478
+ ],
479
+ "SoftwareSerial": [
480
+ "SoftwareSerial.h"
481
+ ],
482
+ "Wire": [
483
+ "Wire.h"
484
+ ],
485
+ "ArduinoJson": [
486
+ "ArduinoJson.h",
487
+ "ArduinoJson.hpp"
488
+ ],
489
+ "EEPROM": [
490
+ "EEPROM.h"
491
+ ],
492
+ "HID": [
493
+ "HID.h"
494
+ ]
495
+ }` )
496
+ }
0 commit comments