Skip to content

Commit

Permalink
Add completion test
Browse files Browse the repository at this point in the history
  • Loading branch information
kitagry committed Jan 17, 2022
1 parent 2af4c6b commit bcdf576
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions langserver/internal/source/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,34 @@ import data.lib
},
expectItems: []source.CompletionItem{},
},
"completion for else": {
files: map[string]source.File{
"src.rego": {
RowText: `package src
authorize = "allow" {
msg := "allow"
trace(msg)
} else = "deny" {
ms := "deny"
ms
}`,
},
},
location: &ast.Location{
Row: 8,
Col: 3,
Offset: len("package src\n\nauthorize = \"allow\" {\n msg := \"allow\"\n trace(msg)\n} else = \"deny\" {\n ms := \"deny\"\n ms"),
Text: []byte("s"),
File: "src.rego",
},
expectItems: []source.CompletionItem{
{
Label: "ms",
Kind: source.VariableItem,
},
},
},
}

for n, tt := range tests {
Expand Down

0 comments on commit bcdf576

Please sign in to comment.