@@ -18,6 +18,7 @@ package compile_part_1_test
1818import (
1919 "crypto/md5"
2020 "encoding/hex"
21+ "encoding/json"
2122 "fmt"
2223 "strings"
2324 "testing"
@@ -285,3 +286,36 @@ func TestCompileWithCustomLibraries(t *testing.T) {
285286 _ , _ , err = cli .Run ("compile" , "--libraries" , firstLib .String (), "--libraries" , secondLib .String (), "-b" , fqbn , sketchPath .String ())
286287 require .NoError (t , err )
287288}
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