Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

test: add backbone testing with testscripts #11

Merged
merged 6 commits into from
Dec 16, 2024

Conversation

tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented Dec 11, 2024

This change is a port from the work I did in gnols (ancestor of this repo) to have a proper testing framework.

It uses testscripts to setup a comprehensive and extensible way to test the gnopls server. The setup consists of running the server and mimicking a LSP client via the "lsp" command used in the txtar files.

Each txtar file is used to assert a specific command or functionnality:

  • testdata/initialize.txtar asserts the lsp initialize command
  • testdata/not_initialize.txtar asserts that lsp initialize must be called prior to any other commands (for this I had to update the server code accordingly)
  • testdata/document_hover.txtar asserts the lsp document/hover command
  • testdata/document_open.txtar assets the lsp document/open command

This is only the beginning as I have introduced many other tests in gnols but pushing all scripts requires some other server changes and I'd rather do that incrementally.

I also added a deps target to the Makefile to install gno, which is required to run the tests. CI workflows have been updated to run this target.

This change is a port from the work I did in `gnols` (ancestor of this
repo) to have a proper testing framework.

It uses testscripts to setup a comprehensive and extensible way to test
the gnopls server. The setup consists of running the server and
mimicking a LSP client via the "lsp" command used in the txtar files.

Each txtar file is used to assert a specific command or functionnality:
- testdata/initialize.txtar asserts the lsp initialize command
- testdata/not_initialize.txtar asserts that lsp initialize must be
  called prior to any other commands (for this I had to update the
  server code accordingly)
- testdata/document_hover.txtar asserts the lsp document/hover command
- testdata/document_open.txtar assets the lsp document/open command

This is only the beginning as I have introduced many other tests in
gnols but pushing all scripts requires some other server changes and I'd
rather do that incrementally.
@tbruyelle tbruyelle requested a review from x1unix as a code owner December 11, 2024 14:18
Because some error messages has changed between 1.22 and 1.23 and the
one asserted in the txtar files are from 1.23
@tbruyelle tbruyelle force-pushed the tbruyelle/test/txtar branch from 665a447 to ebaefb6 Compare December 11, 2024 18:07
internal/lsp/build.go Outdated Show resolved Hide resolved
@x1unix x1unix merged commit 0847953 into gnolang:master Dec 16, 2024
1 check passed
@tbruyelle tbruyelle deleted the tbruyelle/test/txtar branch December 16, 2024 21:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants