@@ -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"
@@ -1475,3 +1476,34 @@ func TestInstallWithZipPathMultipleLibraries(t *testing.T) {
1475
1476
require .DirExists (t , wifiInstallDir .String ())
1476
1477
require .DirExists (t , bleInstallDir .String ())
1477
1478
}
1479
+
1480
+ func TestInstallWithGitUrlLocalFileUri (t * testing.T ) {
1481
+ if runtime .GOOS == "windows" {
1482
+ t .Skip ("Using a file uri as git url doesn't work on Windows, " +
1483
+ "this must be removed when this issue is fixed: https://github.com/go-git/go-git/issues/247" )
1484
+ }
1485
+
1486
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1487
+ defer env .CleanUp ()
1488
+
1489
+ envVar := cli .GetDefaultEnv ()
1490
+ envVar ["ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL" ] = "true"
1491
+
1492
+ libInstallDir := cli .SketchbookDir ().Join ("libraries" , "WiFi101" )
1493
+ // Verifies library is not installed
1494
+ require .NoDirExists (t , libInstallDir .String ())
1495
+
1496
+ // Clone repository locally
1497
+ gitUrl := "https://github.com/arduino-libraries/WiFi101.git"
1498
+ repoDir := cli .SketchbookDir ().Join ("WiFi101" )
1499
+ _ , err := git .PlainClone (repoDir .String (), false , & git.CloneOptions {
1500
+ URL : gitUrl ,
1501
+ })
1502
+ require .NoError (t , err )
1503
+
1504
+ _ , _ , err = cli .RunWithCustomEnv (envVar , "lib" , "install" , "--git-url" , "file:///" + repoDir .String ())
1505
+ require .NoError (t , err )
1506
+
1507
+ // Verifies library is installed
1508
+ require .DirExists (t , libInstallDir .String ())
1509
+ }
0 commit comments