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

Function TestRename_Models

internal/compose/rename_test.go:117–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestRename_Models(t *testing.T) {
118 composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/"))
119 u := uri.URI(composeFileURI)
120 for _, tc := range modelReferenceTestCases {
121 t.Run(tc.name, func(t *testing.T) {
122 doc := document.NewComposeDocument(document.NewDocumentManager(), u, 1, []byte(tc.content))
123 edits, err := Rename(doc, &protocol.RenameParams{
124 TextDocumentPositionParams: protocol.TextDocumentPositionParams{
125 TextDocument: protocol.TextDocumentIdentifier{URI: composeFileURI},
126 Position: protocol.Position{Line: tc.line, Character: tc.character},
127 },
128 NewName: "newName",
129 })
130 require.NoError(t, err)
131 require.Equal(t, tc.renameEdits(composeFileURI), edits)
132 })
133 }
134}
135
136func TestRename_Fragments(t *testing.T) {
137 composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/"))

Callers

nothing calls this directly

Calls 4

NewComposeDocumentFunction · 0.92
NewDocumentManagerFunction · 0.92
RenameFunction · 0.85
URIMethod · 0.65

Tested by

no test coverage detected