alfaix / neotest-gtest

Google Test adapter for nvim-neotest
MIT License
42 stars 11 forks source link

Broken tree lookup in Report creation due to path inconsistency #2

Closed har96 closed 1 year ago

har96 commented 1 year ago

My test statuses were always showing up as failed even though the output clearly showed a passing test. Also, when I tried to run the nearest test using neotest.run.run(), I got the following error:

Error executing luv callback: ...re/nvim/plugged/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../nvim/plugged/neotest-gtest/lua/neotest-gtest/report.lua:68: attempt to index field '_node' (a nil value) stack traceback: [C]: in function 'error' ...re/nvim/plugged/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next' ...re/nvim/plugged/plenary.nvim/lua/plenary/async/async.lua:45: in function <...re/nvim/plugged/plenary.nvim/lua/plenary/async/async.lua:44>

I traced this error down to the fact that the tree in Report:new used absolute paths as keys for test paths, and the Report:position_id used the filename coming out of the gtest output, which on my machine was a relative path, thus resulting in an invalid lookup.

I'm running on Kubuntu with neovim 0.8.2.

Appreciate the plugin and I'm excited about its potential.

alfaix commented 1 year ago

Hey!

Indeed, on my machine, the paths GTest outputs are absolute, so I must have missed this issue in my tests. Thanks a lot for the report and especially for the fix!

I'm a bit unclear on whether the PR resolves both of the issues you mentioned, if it doesn't, then please let me know if one of them isn't resolved and I'll dig deeper into that.

I merged the PR, so otherwise please feel free to close the issue.

har96 commented 1 year ago

Yes, sorry, both errors seemed to come from this one issue, so the fix resolved both. I'll close the issue now. Thanks for the quick turnaround!