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

cmd/qtify #95

Open
josharian opened this issue May 1, 2021 · 6 comments
Open

cmd/qtify #95

josharian opened this issue May 1, 2021 · 6 comments

Comments

@josharian
Copy link

I’d love a source code rewriter that ports existing tests to quicktest. Could start with just the low-hanging fruit, the obvious cases. Bonus for also rewriting from testify. :)

With appropriate docs or a flag, it could even do slightly-semantic-changing things like err != nil to qt.IsNonNil.

@rogpeppe
Copy link
Contributor

rogpeppe commented May 4, 2021

Yes, I've been wanting to do this for ages!

@rogpeppe
Copy link
Contributor

rogpeppe commented May 4, 2021

I'd start with the testify rewrite because I think that's easier and because I'd like it to be easy to suggest that people migrate, and it's more of a clear win.

@rogpeppe
Copy link
Contributor

rogpeppe commented May 4, 2021

bikeshedding on the name: qtfix ? gofixqt ? (I quite like including "go" in Go-oriented commands FWIW).

@dnephin
Copy link

dnephin commented May 4, 2021

(Disclaimer: I am the author of gotest.tools/v3/assert)

In case anyone is interested in a tool that does exactly this for a different assertion library gty-migrate-from-testify does this translation for gotest.tools/v3/assert.

It will rewrite all the common assertions directly, and print a line to stdout for any less-common assertion that could not be translated (which is generally a small number in my experience running the tool on large code bases).

As I mentioned in #94 (comment), there are many similarities with these two libraries.

@frankban
Copy link
Owner

frankban commented May 5, 2021

@dnephin very interesting, thanks for pointing us to that!

@mvdan
Copy link
Contributor

mvdan commented Jan 17, 2022

Damn, this would have saved me at least ten hours of work over the last year :) Happy to help test one such tool.

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

No branches or pull requests

5 participants