Closed mmlb closed 8 years ago
Hello @mmlb! I know nothing of go lang, but I can tell you how it's configured in neoterm. :smile:
It was introduced to neoterm to work only on the all
and current
scopes, it's not prepared to work with file
scope. In all
scope it just run go test
on the current directory.
Hey @kassio, so the problem here is that neoterm does not do the right thing. So in go you can define sub-packages within a repo. In the example I showed there are 2 packages, foo
and bar
. Running neoterm in all
scope only the tests for the foo
package are run. This is because go test
is called vs go test ./...
which a synonym for -r/--recursive
in other tools.
But, now this shows another issue. What if I only want to run the test of the current package as is currently done...? Well that's the reason I mentioned a new scope, recursive
, so that all
means "all the tests in the current package", and recursive
means "all tests in all packages".
As I said previously, I have no idea on how go test
works. So I think is fair we ask @vhakulinen opinion, on this one, he was who introduced go lang
support to neoterm. :smile:
TIL: running go test ./<subpackage>
runs tests on that package (but go test <subpackage>
doesn't).
edit: I currently dont have time to implement these features (if there even is sane way to do it), but if you want you can check out vim-go which has commands for running test.
Yeah vim-go is great, currently use it but neoterm looked like a nice way to run the tests. I don't have any VimL experience so can't implement myself. @kassio not sure if you want to keep this and #77 open in case some one else happens to come along...
I don't have problems in help with these people. I'd just like to know exactly how each scope should run. Given that I can update neoterm to run go tests
as needed. :smile:
So I think making file
scope do go test ./$(dirname $file)
(which I just learned about here, thanks @vhakulinen) would be great (I'd be happy to test). And now you could say that neoterm allows file scope for go programs (with a caveat being its actually package scope (one that I think most go users would actually expect)).
Which then means that all
scope should actually call go test ./...
which will recursively run all the tests.
hey @kassio cool fix, I guess I was thinking about how to implement just in vimscript. I'll give it a try soon. Thanks again.
having a file structure like:
and $CWD == foo I would expect 'all' scope to run
go test ./...
which will run tests for sub-packages, currently onlygo test
is run which only runs tests infoo_test.go
But this also means that we can't test only
foo
as is currently done. Maybe there should be a new scoperecursive
? go can't possibly the only language that would have this problem...