Skip to content

Commit

Permalink
tests: Fatal error when no inlay hints are found (#1060)
Browse files Browse the repository at this point in the history
Otherwise this test can fail like this

```
2024/09/05 13:33:37 jsonrpc2: protocol error: io: read/write on closed pipe
  --- FAIL: TestGetInlayHintsAstTerms (0.00s)
      inlayhint_test.go:71: Expected 1 inlay hints, got 0
  panic: runtime error: index out of range [0] with length 0 [recovered]
  	panic: runtime error: index out of range [0] with length 0

  goroutine 14 [running]:
  testing.tRunner.func1.2({0x105567cc0, 0x14006a02be8})
  	/Users/runner/hostedtoolcache/go/1.22.5/arm64/src/testing/testing.go:1631 +0x1c4
  testing.tRunner.func1()
  	/Users/runner/hostedtoolcache/go/1.22.5/arm64/src/testing/testing.go:1634 +0x33c
  panic({0x105567cc0?, 0x14006a02be8?})
  	/Users/runner/hostedtoolcache/go/1.22.5/arm64/src/runtime/panic.go:770 +0x124
  github.com/styrainc/regal/internal/lsp.TestGetInlayHintsAstTerms(0x14000c71040)
  	/Users/runner/work/regal/regal/internal/lsp/inlayhint_test.go:74 +0x228
  testing.tRunner(0x14000c71040, 0x1055c7d68)
  	/Users/runner/hostedtoolcache/go/1.22.5/arm64/src/testing/testing.go:1689 +0xec
  created by testing.(*T).Run in goroutine 1
  	/Users/runner/hostedtoolcache/go/1.22.5/arm64/src/testing/testing.go:1742 +0x318
  FAIL	github.com/styrainc/regal/internal/lsp	4.128s
```

https://github.com/StyraInc/regal/actions/runs/10721446802/job/29729982494?pr=1059

Signed-off-by: Charlie Egan <charlie@styra.com>
  • Loading branch information
charlieegan3 authored Sep 5, 2024
1 parent 410d775 commit 337862e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/lsp/inlayhint_test.go
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ func TestGetInlayHintsAstTerms(t *testing.T) {
inlayHints := getInlayHints(module)

if len(inlayHints) != 1 {
t.Errorf("Expected 1 inlay hints, got %d", len(inlayHints))
t.Fatalf("Expected 1 inlay hints, got %d", len(inlayHints))
}

if inlayHints[0].Label != "x:" {

0 comments on commit 337862e

Please # to comment.