Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stretchr/testify and :GoTest multiline issue #168

Closed
shmup opened this issue Sep 9, 2014 · 2 comments
Closed

stretchr/testify and :GoTest multiline issue #168

shmup opened this issue Sep 9, 2014 · 2 comments

Comments

@shmup
Copy link

shmup commented Sep 9, 2014

I attached two screenshots. One shows how go test renders in a terminal, and the other when using :GoTest within vim. I'm using testify mostly for assert functionality.

I chatted with fatih a bit in #go-nuts, and it was said that vim-go has pretty basic support for multilines. Now, since this is surely the result of me using another library, this might not be worthy of an issue here. I'll just risk it being closed. :)

screenshot 2014-09-09 19 46 45
screenshot 2014-09-09 19 47 40

@fatih
Copy link
Owner

fatih commented Sep 10, 2014

There needs be a either a separate plugin or testify needs a testing compatible output so vim-go can parse it. I would say it's not the work worth to implement, there are many other testing packages too, I don't want to spend time on these. But you can just add yourself another command like :GoTestify which would parse that output.

@fatih fatih closed this as completed Sep 10, 2014
@brennanc
Copy link

I know its not ideal or desirable at all, but I worked around this by modifying the go#tool#ShowErrors() function in vim-go/autoload/go/tool.vim.

I just replaced the let tokens = matchlist(... line near the top of the function with the following block:

        let testify_tokens = matchlist(line, '^.*Location:\s*\(.\{-}\):\(\d\+\)\(.*\)')
        if !empty(testify_tokens)
            let tokens = testify_tokens
        else
            let tokens = matchlist(line, '^\s*\(.\{-}\):\(\d\+\):\s*\(.*\)')
        endif

I haven't thoroughly tested, but it appears to work for both testify-based tests, and regular Go tests. However, YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants