zls icon indicating copy to clipboard operation
zls copied to clipboard

Improve tests

Open alexnask opened this issue 5 years ago • 4 comments

Sooner or later we will need to add tests to check for regressions.

I propose the following three kinds of tests:

  • Function unit tests (mainly for the parsing functions)
  • I/O testing: simulate a client sending requests from a different process and check the responses are correct
  • Internal state testing: simulate a client sending requests from a different process and check our internal state (number of documents, text of documents, latest sane_text of documents etc.)

alexnask avatar May 07 '20 18:05 alexnask

Looks interesting. Not sure if it's a priority right now, but definitely down the line.

SuperAuguste avatar May 07 '20 18:05 SuperAuguste

Started adding session tests, coverage going up 🎉

alexnask avatar Jun 30 '20 17:06 alexnask

hi i recently started learning zig and this seems like a beginner-friendly issue to get started with but when i try to run unit tests using zig test unit_test.zig i get an error saying

./unit_tests.zig:2:15: error: unable to find 'types'
const types = @import("types");
              ^
./unit_tests.zig:23:43: note: referenced here
fn makeUnnamedDocument(text: []const u8) !types.TextDocument {
                                          ^
./unit_tests.zig:31:21: note: referenced here
    const doc = try makeUnnamedDocument(final_line);
                    ^
./unit_tests.zig:68:5: note: referenced here
    try testContext(
    ^

am i running the tests the wrong way ? i tried looking for docs on testing and also tried looking in the ci workflow for a test job but couldnt find anything.

PS i am able to build the repo locally

palash25 avatar Oct 29 '20 10:10 palash25

am i running the tests the wrong way ?

Yes. Try execute zig build test in zls root folder.

data-man avatar Oct 29 '20 11:10 data-man

I think #609 closed this. Closing in favor of #623.

SuperAuguste avatar Sep 03 '22 19:09 SuperAuguste