-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
34 lines (30 loc) · 1.01 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main_test
import (
"os"
"strings"
"testing"
"github.com/kusold/goclone"
)
var expectedGitPath = strings.Join([]string{os.Getenv("GOPATH"), "src", "github.com", "kusold", "goclone"}, "/")
var parseGitPathTests = []struct {
in string
out string
}{
{"[email protected]:kusold/goclone.git", expectedGitPath},
{"ssh://[email protected]:22/kusold/goclone.git", expectedGitPath},
{"ssh://[email protected]:22/kusold/goclone.git/", expectedGitPath},
{"git://github.com:22/kusold/goclone.git", expectedGitPath},
{"http://github.com:22/kusold/goclone.git", expectedGitPath},
{"https://github.com:22/kusold/goclone.git", expectedGitPath},
{"ftp://github.com:22/kusold/goclone.git", expectedGitPath},
{"ftps://github.com:22/kusold/goclone.git", expectedGitPath},
{"[email protected]:kusold/goclone.git", expectedGitPath},
}
func TestParseGitPath(t *testing.T) {
for _, test := range parseGitPathTests {
actual := main.ParseGitPath(test.in)
if actual != test.out {
t.Error("Expected:", test.out, "Actual:", actual)
}
}
}