-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: testing: allow regexps to specify example output #18831
Comments
Why do you need this, exactly? Is the plaintext output too big or non-deterministic? The point of output lines is readability and simplicity, and I think regexes would just add complexity. |
I have a program that part of the output there is a time duration, that i would like to give an example for. |
Note that you'll also need to introduce an alternative prefix (not |
you could sanitize the output before printing.
(e.g. use regexp to replace the number with a fixed number before print
them.)
Not only does this not require a new facility, it also allows the users to
use older versions of Go.
|
I saw in the code that there is |
I think we'd prefer not to further complicate output tests. Doing something like replacing the time with "TIMESTAMP" in the output would be better. Or just don't print it in the first place. |
I also don't want to do anything here. The whole point of examples to be simple. Once you need a way to normalize the output, you've already failed at being simple. |
Declining for @golang/proposal-review |
CL https://golang.org/cl/36050 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.4 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Wrote a testable example.
What did you expect to see?
A possibility to define
Output
lines with a regular expression.What did you see instead?
Only plan text is supported.
The text was updated successfully, but these errors were encountered: