nvim-neotest / neotest-go

MIT License
124 stars 43 forks source link

fix: nil error on test single function #48

Closed michaldziurowski closed 1 year ago

michaldziurowski commented 1 year ago

Removed reference from not initialized file_id variable to value.id. Fixes: https://github.com/nvim-neotest/neotest-go/issues/47

zankich commented 1 year ago

Just tried this branch out and it fixes the issue!

sergii4 commented 1 year ago

Hi @michaldziurowski, it fails test lua/spec/neotest-go/init_spec.lua. Ideally, it shouldn't fix one issue and create another.

Success ||      prepare_results check that we have file level test result as well as all nested results in cases_test.go
Fail    ||      prepare_results check that we have correct file level test result status cases_test.go
            ...re/nvim/site/pack/packer/start/neotest/lua/nio/tests.lua:27: Test task failed with message:
            The coroutine failed with this message: 
            ...acker/start/neotest-go/lua/spec/neotest-go/init_spec.lua:272: Expected objects to be equal.
            Passed in:
            (string) 'passed'
            Expected:
            (string) 'failed'
            stack traceback:
                [C]: in function 'error'
                ...e/pack/packer/start/plenary.nvim/lua/luassert/assert.lua:51: in function 'equals'
                ...acker/start/neotest-go/lua/spec/neotest-go/init_spec.lua:272: in function <...acker/start/neotest-go/lua/spec/neotest-go/init_spec.l
ua:244>

            stack traceback:
                ...re/nvim/site/pack/packer/start/neotest/lua/nio/tests.lua:27: in function <...re/nvim/site/pack/packer/start/neotest/lua/nio/tests.lu
a:12>
zankich commented 1 year ago

@sergii4 what are the steps for running the test suite?

michaldziurowski commented 1 year ago

Hi @michaldziurowski, it fails test lua/spec/neotest-go/init_spec.lua. Ideally, it shouldn't fix one issue and create another.

Yep, I rushed a bit with removal of file_id, sorry. Fixed. Will provide some additional tests later. Sidenote: it seems that there are other test which are also failing in init_spec.lua not related to this change, or is it just my env ?

what are the steps for running the test suite?

I'm new to lua so maybe there is better way but I'm using plenary test runner via :PlenaryBustedDirectory lua/spec from inside of neotest-go dir.

zankich commented 1 year ago

hey @michaldziurowski I also have a PR which fixes this and related diagnostic errors while parsing test output https://github.com/nvim-neotest/neotest-go/pull/49

sergii4 commented 1 year ago

Hi @michaldziurowski to run test you need: https://github.com/nvim-neotest/neotest-go/pull/49#issuecomment-1544546253

sergii4 commented 1 year ago

Hi @michaldziurowski, yeah, it seems pretty logical that attempt index nil value caused by nil. I tested your change, it works for me and tests pass.

Thank you for sparing your time on it