(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func TestDefinition_Models(t *testing.T) { |
| 148 | composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/")) |
| 149 | u := uri.URI(composeFileURI) |
| 150 | for _, tc := range modelReferenceTestCases { |
| 151 | doc := document.NewComposeDocument(document.NewDocumentManager(), u, 1, []byte(tc.content)) |
| 152 | params := protocol.DefinitionParams{ |
| 153 | TextDocumentPositionParams: protocol.TextDocumentPositionParams{ |
| 154 | TextDocument: protocol.TextDocumentIdentifier{URI: composeFileURI}, |
| 155 | Position: protocol.Position{Line: tc.line, Character: tc.character}, |
| 156 | }, |
| 157 | } |
| 158 | |
| 159 | t.Run(fmt.Sprintf("%v (Location)", tc.name), func(t *testing.T) { |
| 160 | locations, err := Definition(context.Background(), false, doc, ¶ms) |
| 161 | require.NoError(t, err) |
| 162 | require.Equal(t, tc.locations(composeFileURI), locations) |
| 163 | }) |
| 164 | |
| 165 | t.Run(fmt.Sprintf("%v (LocationLink)", tc.name), func(t *testing.T) { |
| 166 | links, err := Definition(context.Background(), true, doc, ¶ms) |
| 167 | require.NoError(t, err) |
| 168 | require.Equal(t, tc.links(composeFileURI), links) |
| 169 | }) |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | func TestDefinition_Fragments(t *testing.T) { |
| 174 | composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/")) |
nothing calls this directly
no test coverage detected