@@ -18,6 +18,7 @@ package compile_part_1_test
18
18
import (
19
19
"crypto/md5"
20
20
"encoding/hex"
21
+ "encoding/json"
21
22
"fmt"
22
23
"strings"
23
24
"testing"
@@ -285,3 +286,36 @@ func TestCompileWithCustomLibraries(t *testing.T) {
285
286
_ , _ , err = cli .Run ("compile" , "--libraries" , firstLib .String (), "--libraries" , secondLib .String (), "-b" , fqbn , sketchPath .String ())
286
287
require .NoError (t , err )
287
288
}
289
+
290
+ func TestCompileWithArchivesAndLongPaths (t * testing.T ) {
291
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
292
+ defer env .CleanUp ()
293
+
294
+ // Creates config with additional URL to install necessary core
295
+ url := "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
296
+ _ , _ , err := cli .Run ("config" , "init" , "--dest-dir" , "." , "--additional-urls" , url )
297
+ require .NoError (t , err )
298
+
299
+ // Init the environment explicitly
300
+ _ , _ , err = cli .Run ("update" )
301
+ require .NoError (t , err )
302
+
303
+ // Install core to compile
304
+ _ , _ , err = cli .Run ("core" , "install" , "esp8266:esp8266@2.7.4" )
305
+ require .NoError (t , err )
306
+
307
+ // Install test library
308
+ _ , _ , err = cli .Run ("lib" , "install" , "ArduinoIoTCloud" )
309
+ require .NoError (t , err )
310
+
311
+ stdout , _ , err := cli .Run ("lib" , "examples" , "ArduinoIoTCloud" , "--format" , "json" )
312
+ require .NoError (t , err )
313
+ var libOutput []map [string ]interface {}
314
+ err = json .Unmarshal (stdout , & libOutput )
315
+ require .NoError (t , err )
316
+ sketchPath := paths .New (libOutput [0 ]["library" ].(map [string ]interface {})["install_dir" ].(string ))
317
+ sketchPath = sketchPath .Join ("examples" , "ArduinoIoTCloud-Advanced" )
318
+
319
+ _ , _ , err = cli .Run ("compile" , "-b" , "esp8266:esp8266:huzzah" , sketchPath .String ())
320
+ require .NoError (t , err )
321
+ }
0 commit comments