MCPcopy Create free account
hub / github.com/docker/docker-language-server / TestDocumentPath

Function TestDocumentPath

internal/pkg/document/document_test.go:121–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func 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
151func TestDocumentPathNonWindows(t *testing.T) {
152 if runtime.GOOS == "windows" {

Callers

nothing calls this directly

Calls 3

DocumentPathMethod · 0.95
NewDocumentManagerFunction · 0.85
NewDocumentFunction · 0.85

Tested by

no test coverage detected