Skip to content

Commit

Permalink
feat(definition): fix tests for variable defintion
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Jun 29, 2024
1 parent 73cc7bd commit d332a06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 57 deletions.
13 changes: 4 additions & 9 deletions internal/handler/definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,8 @@ func TestDefinitionVariable(t *testing.T) {
{
URI: testDocumentTemplateURI,
Range: lsp.Range{
Start: lsp.Position{Line: 1, Character: 22},
End: lsp.Position{
Line: 14,
Character: 0,
},
Start: lsp.Position{Line: 1, Character: 3},
End: lsp.Position{Line: 1, Character: 22},
},
},
}, nil)
Expand All @@ -128,10 +125,8 @@ func TestDefinitionRange(t *testing.T) {
{
URI: testDocumentTemplateURI,
Range: lsp.Range{
Start: lsp.Position{
Line: 7,
Character: 17,
},
Start: lsp.Position{Line: 7, Character: 17},
End: lsp.Position{Line: 7, Character: 37},
},
},
}, nil)
Expand Down
56 changes: 8 additions & 48 deletions internal/lsp/symbol_table_variables_visitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@ func TestSymbolTableForVariableDefinitions(t *testing.T) {
{
Value: ".",
VariableType: VariableTypeAssigment,
Scope: sitter.Range{
StartPoint: sitter.Point{
Row: 0,
Column: 14,
},
EndPoint: sitter.Point{
Row: 0,
Column: 19,
},
StartByte: 14,
EndByte: 19,
},
Scope: sitter.Range{StartPoint: sitter.Point{Row: 0, Column: 14}, EndPoint: sitter.Point{Row: 0, Column: 19}, StartByte: 14, EndByte: 19},
Range: sitter.Range{StartPoint: sitter.Point{Row: 0, Column: 4}, EndPoint: sitter.Point{Row: 0, Column: 14}, StartByte: 4, EndByte: 14},
},
},
},
Expand All @@ -49,36 +39,16 @@ func TestSymbolTableForVariableDefinitions(t *testing.T) {
{
Value: "$root.Values.deployments",
VariableType: VariableTypeRangeKeyOrIndex,
Scope: sitter.Range{
StartPoint: sitter.Point{
Row: 1,
Column: 60,
},
EndPoint: sitter.Point{
Row: 3,
Column: 15,
},
StartByte: 61,
EndByte: 101,
},
Scope: sitter.Range{StartPoint: sitter.Point{Row: 1, Column: 60}, EndPoint: sitter.Point{Row: 3, Column: 15}, StartByte: 61, EndByte: 101},
Range: sitter.Range{StartPoint: sitter.Point{Row: 1, Column: 18}, EndPoint: sitter.Point{Row: 1, Column: 60}, StartByte: 19, EndByte: 61},
},
},
"$config": {
{
Value: "$root.Values.deployments",
VariableType: VariableTypeRangeValue,
Scope: sitter.Range{
StartPoint: sitter.Point{
Row: 1,
Column: 60,
},
EndPoint: sitter.Point{
Row: 3,
Column: 15,
},
StartByte: 61,
EndByte: 101,
},
Scope: sitter.Range{StartPoint: sitter.Point{Row: 1, Column: 60}, EndPoint: sitter.Point{Row: 3, Column: 15}, StartByte: 61, EndByte: 101},
Range: sitter.Range{StartPoint: sitter.Point{Row: 1, Column: 25}, EndPoint: sitter.Point{Row: 1, Column: 60}, StartByte: 26, EndByte: 61},
},
},
},
Expand All @@ -90,18 +60,8 @@ func TestSymbolTableForVariableDefinitions(t *testing.T) {
{
Value: ".Values",
VariableType: VariableTypeAssigment,
Scope: sitter.Range{
StartPoint: sitter.Point{
Row: 0,
Column: 16,
},
EndPoint: sitter.Point{
Row: 0,
Column: 50,
},
StartByte: 16,
EndByte: 50,
},
Scope: sitter.Range{StartPoint: sitter.Point{Row: 0, Column: 16}, EndPoint: sitter.Point{Row: 0, Column: 50}, StartByte: 16, EndByte: 50},
Range: sitter.Range{StartPoint: sitter.Point{Row: 0, Column: 3}, EndPoint: sitter.Point{Row: 0, Column: 16}, StartByte: 3, EndByte: 16},
},
},
},
Expand Down

0 comments on commit d332a06

Please sign in to comment.