@@ -621,3 +621,36 @@ def test_install_with_zip_path_multiple_libraries(run_command, downloads_dir, da
621
621
# Verifies library are installed
622
622
assert wifi_install_dir .exists ()
623
623
assert ble_install_dir .exists ()
624
+
625
+
626
+ def test_lib_examples (run_command , data_dir ):
627
+ assert run_command ("update" )
628
+
629
+ assert run_command ("lib install Arduino_JSON@0.1.0" )
630
+
631
+ res = run_command ("lib examples Arduino_JSON --format json" )
632
+ assert res .ok
633
+ data = json .loads (res .stdout )
634
+ assert len (data ) == 1
635
+ examples = data [0 ]["examples" ]
636
+
637
+ assert str (Path (data_dir , "libraries" , "Arduino_JSON" , "examples" , "JSONArray" )) in examples
638
+ assert str (Path (data_dir , "libraries" , "Arduino_JSON" , "examples" , "JSONKitchenSink" )) in examples
639
+ assert str (Path (data_dir , "libraries" , "Arduino_JSON" , "examples" , "JSONObject" )) in examples
640
+
641
+
642
+ def test_lib_examples_with_pde_file (run_command , data_dir ):
643
+ assert run_command ("update" )
644
+
645
+ assert run_command ("lib install Encoder@1.4.1" )
646
+
647
+ res = run_command ("lib examples Encoder --format json" )
648
+ assert res .ok
649
+ data = json .loads (res .stdout )
650
+ assert len (data ) == 1
651
+ examples = data [0 ]["examples" ]
652
+
653
+ assert str (Path (data_dir , "libraries" , "Encoder" , "examples" , "Basic" )) in examples
654
+ assert str (Path (data_dir , "libraries" , "Encoder" , "examples" , "NoInterrupts" )) in examples
655
+ assert str (Path (data_dir , "libraries" , "Encoder" , "examples" , "SpeedTest" )) in examples
656
+ assert str (Path (data_dir , "libraries" , "Encoder" , "examples" , "TwoKnobs" )) in examples
0 commit comments