Skip to content

Commit

Permalink
Create files on disk for symbol handler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Nov 28, 2024
1 parent 53bbc2d commit 7000608
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions internal/langserver/handlers/workspace_symbol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package handlers

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/hashicorp/terraform-ls/internal/langserver"
Expand All @@ -18,6 +20,15 @@ func TestLangServer_workspace_symbol_basic(t *testing.T) {
tmpDir := TempDir(t)
InitPluginCache(t, tmpDir.Path())

err := os.WriteFile(filepath.Join(tmpDir.Path(), "first.tf"), []byte("provider \"github\" {}\n"), 0o755)
if err != nil {
t.Fatal(err)
}
err = os.WriteFile(filepath.Join(tmpDir.Path(), "second.tf"), []byte("provider \"google\" {}\n"), 0o755)
if err != nil {
t.Fatal(err)
}

ss, err := state.NewStateStore()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -166,6 +177,15 @@ func TestLangServer_workspace_symbol_missing(t *testing.T) {
tmpDir := TempDir(t)
InitPluginCache(t, tmpDir.Path())

err := os.WriteFile(filepath.Join(tmpDir.Path(), "first.tf"), []byte("provider \"github\" {}\n"), 0o755)
if err != nil {
t.Fatal(err)
}
err = os.WriteFile(filepath.Join(tmpDir.Path(), "second.tf"), []byte("provider \"google\" {}\n"), 0o755)
if err != nil {
t.Fatal(err)
}

ss, err := state.NewStateStore()
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 7000608

Please sign in to comment.