Closed bravoecho closed 1 year ago
Hi @bravoecho, support of map table test comes with #55 :)
That's such wonderful news, thank you, well done you folks!
I have tested it both manually and with unit test, but let me know if it doesn't work as expected
The map-based tests work perfectly, they are correctly marked as passing or failing when run in bulk, and they can also be run individually with :TestThis
, which is super-brilliant!
On an unrelated note, I noticed something in the Go tests for the struct-based table tests, where individually failing tests are not reported correctly. For example, on a slightly modified version of the test:
By adding an assertion, and setting up of the tests to fail, the package-level test is correctly reported as failing, but one cannot see which subtest caused the failure.
It threw me off for a second, and I thought maybe it's a regression, but then I realised that it's just the infamous loop variable striking again, because the Run()
function reuses the t
from the closure (due to the underscore) ๐น
Anyway, I really think this feature that you just improved is one of the absolute coolest in all of Neovim, the wow factor, the "a-ha!" moment, the "I-didn't-know-Vim-could-do-this!" feature.
Thanks, @bravoecho for the feedback, I am really happy to hear that!
Following the recent fixes, I now use the table-driven support extensively, and it's become essential to me.
Some of the table-driven tests I work on were written as
map[string]struct{...}
, following the advice by Dave Cheney (https://dave.cheney.net/2019/05/07/prefer-table-driven-tests), and these are not detected.I tried to hack the Tree Sitter query myself into something like the snippet at the bottom, but I don't seem to be able to obtain a working solution.
I'll keep trying as this would be a killer feature for me, but in the meantime I would also like to ask for your help, if you had the time to look into this you would have my undying gratitude.
Thank you! ๐
PS: This is my attempt, it kind-of works in the online Tree Sitter Playground, as it catches the expected elements, but then it breaks if I try and use it in place of the original query