@@ -40,6 +40,41 @@ func TestDefaultWorkspaceFolder(t *testing.T) {
40
40
gitURL : "https://github.com/coder/envbuilder.git#feature-branch" ,
41
41
expected : "/workspaces/envbuilder" ,
42
42
},
43
+ {
44
+ name : "trailing" ,
45
+ gitURL : "https://github.com/coder/envbuilder.git/" ,
46
+ expected : "/workspaces/envbuilder" ,
47
+ },
48
+ {
49
+ name : "trailing-x2" ,
50
+ gitURL : "https://github.com/coder/envbuilder.git//" ,
51
+ expected : "/workspaces/envbuilder" ,
52
+ },
53
+ {
54
+ name : "fragment-trailing" ,
55
+ gitURL : "https://github.com/coder/envbuilder.git/#refs/heads/feature-branch" ,
56
+ expected : "/workspaces/envbuilder" ,
57
+ },
58
+ {
59
+ name : "space" ,
60
+ gitURL : "https://github.com/coder/env%20builder.git" ,
61
+ expected : "/workspaces/env builder" ,
62
+ },
63
+ {
64
+ name : "no .git" ,
65
+ gitURL : "https://github.com/coder/envbuilder" ,
66
+ expected : "/workspaces/envbuilder" ,
67
+ },
68
+ {
69
+ name : "Unix path" ,
70
+ gitURL : "/repo" ,
71
+ expected : "/workspaces/repo" ,
72
+ },
73
+ {
74
+ name : "Unix subpath" ,
75
+ gitURL : "/path/to/repo" ,
76
+ expected : "/workspaces/repo" ,
77
+ },
43
78
{
44
79
name : "empty" ,
45
80
gitURL : "" ,
@@ -65,6 +100,10 @@ func TestDefaultWorkspaceFolder(t *testing.T) {
65
100
name : "website URL" ,
66
101
invalidURL : "www.google.com" ,
67
102
},
103
+ {
104
+ name : "Unix root" ,
105
+ invalidURL : "/" ,
106
+ },
68
107
}
69
108
for _ , tt := range invalidTests {
70
109
t .Run (tt .name , func (t * testing.T ) {
0 commit comments