(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestDocumentPath(t *testing.T) { |
| 122 | testCases := []struct { |
| 123 | name string |
| 124 | u uri.URI |
| 125 | folder string |
| 126 | fileName string |
| 127 | wsl bool |
| 128 | }{ |
| 129 | { |
| 130 | name: "Windows wsl$ host URI", |
| 131 | u: "file://wsl%24/docker-desktop/tmp/Dockerfile", |
| 132 | folder: "/docker-desktop/tmp", |
| 133 | fileName: "Dockerfile", |
| 134 | wsl: true, |
| 135 | }, |
| 136 | } |
| 137 | |
| 138 | for _, tc := range testCases { |
| 139 | t.Run(tc.name, func(t *testing.T) { |
| 140 | mgr := NewDocumentManager() |
| 141 | document := NewDocument(mgr, tc.u, protocol.DockerfileLanguage, 1, []byte{}) |
| 142 | path, err := document.DocumentPath() |
| 143 | require.NoError(t, err) |
| 144 | require.Equal(t, tc.folder, path.Folder) |
| 145 | require.Equal(t, tc.fileName, path.FileName) |
| 146 | require.Equal(t, tc.wsl, path.WSLDollarSignHost) |
| 147 | }) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func TestDocumentPathNonWindows(t *testing.T) { |
| 152 | if runtime.GOOS == "windows" { |
nothing calls this directly
no test coverage detected