@@ -35,11 +35,56 @@ func TestDefaultWorkspaceFolder(t *testing.T) {
3535 gitURL : "https://username:password@github.com/coder/envbuilder.git" ,
3636 expected : "/workspaces/envbuilder" ,
3737 },
38+ {
39+ name : "trailing" ,
40+ gitURL : "https://github.com/coder/envbuilder.git/" ,
41+ expected : "/workspaces/envbuilder" ,
42+ },
43+ {
44+ name : "trailing-x2" ,
45+ gitURL : "https://github.com/coder/envbuilder.git//" ,
46+ expected : "/workspaces/envbuilder" ,
47+ },
48+ {
49+ name : "no .git" ,
50+ gitURL : "https://github.com/coder/envbuilder" ,
51+ expected : "/workspaces/envbuilder" ,
52+ },
53+ {
54+ name : "trailing no .git" ,
55+ gitURL : "https://github.com/coder/envbuilder/" ,
56+ expected : "/workspaces/envbuilder" ,
57+ },
3858 {
3959 name : "fragment" ,
4060 gitURL : "https://github.com/coder/envbuilder.git#feature-branch" ,
4161 expected : "/workspaces/envbuilder" ,
4262 },
63+ {
64+ name : "fragment-trailing" ,
65+ gitURL : "https://github.com/coder/envbuilder.git/#refs/heads/feature-branch" ,
66+ expected : "/workspaces/envbuilder" ,
67+ },
68+ {
69+ name : "fragment-trailing no .git" ,
70+ gitURL : "https://github.com/coder/envbuilder/#refs/heads/feature-branch" ,
71+ expected : "/workspaces/envbuilder" ,
72+ },
73+ {
74+ name : "space" ,
75+ gitURL : "https://github.com/coder/env%20builder.git" ,
76+ expected : "/workspaces/env builder" ,
77+ },
78+ {
79+ name : "Unix path" ,
80+ gitURL : "/repo" ,
81+ expected : "/workspaces/repo" ,
82+ },
83+ {
84+ name : "Unix subpath" ,
85+ gitURL : "/path/to/repo" ,
86+ expected : "/workspaces/repo" ,
87+ },
4388 {
4489 name : "empty" ,
4590 gitURL : "" ,
@@ -65,6 +110,18 @@ func TestDefaultWorkspaceFolder(t *testing.T) {
65110 name : "website URL" ,
66111 invalidURL : "www.google.com" ,
67112 },
113+ {
114+ name : "Unix root" ,
115+ invalidURL : "/" ,
116+ },
117+ {
118+ name : "Path consists entirely of slash" ,
119+ invalidURL : "//" ,
120+ },
121+ {
122+ name : "Git URL with no path" ,
123+ invalidURL : "http://127.0.0.1:41073" ,
124+ },
68125 }
69126 for _ , tt := range invalidTests {
70127 t .Run (tt .name , func (t * testing.T ) {
0 commit comments