Skip to content

Commit

Permalink
chore: additional lsp test
Browse files Browse the repository at this point in the history
  • Loading branch information
joerdav committed Sep 6, 2024
1 parent 78015d5 commit b866836
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmd/templ/lspcmd/lsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,33 @@ func TestReferences(t *testing.T) {
return "", true
},
},
{
// this is the definition of the struct in the templates.templ file.
line: 21,
character: 9,
assert: func(t *testing.T, actual []protocol.Location) (msg string, ok bool) {
expectedReference := []protocol.Location{
{
// This is the useage of the struct in the templates.templ file.
URI: uri.URI("file://" + appDir + "/templates.templ"),
Range: protocol.Range{
Start: protocol.Position{
Line: uint32(24),
Character: uint32(8),
},
End: protocol.Position{
Line: uint32(24),
Character: uint32(14),
},
},
},
}
if diff := lspdiff.References(expectedReference, actual); diff != "" {
return fmt.Sprintf("Expected: %+v\nActual: %+v", expectedReference, actual), false
}
return "", true
},
},
}

for i, test := range tests {
Expand Down

0 comments on commit b866836

Please sign in to comment.