@@ -20,6 +20,7 @@ import (
20
20
"fmt"
21
21
"io"
22
22
"net/http"
23
+ "runtime"
23
24
"strings"
24
25
"testing"
25
26
"time"
@@ -1446,3 +1447,34 @@ func TestInstallWithZipPathMultipleLibraries(t *testing.T) {
1446
1447
require .DirExists (t , wifiInstallDir .String ())
1447
1448
require .DirExists (t , bleInstallDir .String ())
1448
1449
}
1450
+
1451
+ func TestInstallWithGitUrlLocalFileUri (t * testing.T ) {
1452
+ if runtime .GOOS == "windows" {
1453
+ t .Skip ("Using a file uri as git url doesn't work on Windows, " +
1454
+ "this must be removed when this issue is fixed: https://github.com/go-git/go-git/issues/247" )
1455
+ }
1456
+
1457
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1458
+ defer env .CleanUp ()
1459
+
1460
+ envVar := cli .GetDefaultEnv ()
1461
+ envVar ["ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL" ] = "true"
1462
+
1463
+ libInstallDir := cli .SketchbookDir ().Join ("libraries" , "WiFi101" )
1464
+ // Verifies library is not installed
1465
+ require .NoDirExists (t , libInstallDir .String ())
1466
+
1467
+ // Clone repository locally
1468
+ gitUrl := "https://github.com/arduino-libraries/WiFi101.git"
1469
+ repoDir := cli .SketchbookDir ().Join ("WiFi101" )
1470
+ _ , err := git .PlainClone (repoDir .String (), false , & git.CloneOptions {
1471
+ URL : gitUrl ,
1472
+ })
1473
+ require .NoError (t , err )
1474
+
1475
+ _ , _ , err = cli .RunWithCustomEnv (envVar , "lib" , "install" , "--git-url" , "file:///" + repoDir .String ())
1476
+ require .NoError (t , err )
1477
+
1478
+ // Verifies library is installed
1479
+ require .DirExists (t , libInstallDir .String ())
1480
+ }
0 commit comments