Table test subtests with non-string names are not recognized correctly #377
Replies: 1 comment
-
Hey @oleynikandrey, I don't think it will be easy to support this. I've investigated whether Go itself can be used during the test detection phase, in addition (or replacing) AST parsing in lua. But I haven't found any way for Go to return all test found during runtime without also executing them. If you find a way, I'm all ears. With #373 I'm adding streaming support. This means I will be able to detect tests not in the Neotest tree. Theoretically it could (I'm not sure) be possible to inject new nodes into the tree, but they would disappear if you save the file as Neotest would re-run the AST parsing and re-draw the tree. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When writing table-driven tests in Go, neotest-golang does not recognize subtests correctly if the name of a subtest is not a simple string literal, but an expression (for example, using
fmt.Sprintf
or concatenation). In these cases, the whole table test is shown as a single test, and individual subtests are not detected or displayed.Steps to reproduce:
Expected behavior:
Actual behavior:
I understand that these values are calculated at runtime, but I wonder if support for this could be added.
Beta Was this translation helpful? Give feedback.
All reactions