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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering output support #25
Comments
Here is an implementation of something similar: https://github.com/echlebek/grill/blob/b16dbd1a097be186cad7e5cf840ab802e4cfaa3a/internal/grill/diff.go which we could borrow from? |
I agree that filtering support would be nice. I don't think the I think it's better to filter in code, because you can be more precise and more general. For example, https://go.googlesource.com/vuln/+/refs/heads/master/cmd/govulncheck/main_command_118_test.go#56. Not sure I understand the relevance of the diff code. |
Ahh I see what you mean and what you're doing. I'm writing all my tests purely in |
The issue I have I guess is that if I have to write normal Go code to test some parts of my CLI (becuase they produce outputs that are not predictable) I may as well write all the tests in Go and this devalues your |
I haven't found that it devalues the package. There is still plenty for it to do. Notice that the tests are still encoded in .ct files, as commands and responses. I just post-process the command output in one place to generalize it. |
For this ti work well, I would have to split out my test execution into per-directory tests containing |
I don't think so, but I may not understand your situation. Here's an example of what I'm saying: imagine you're testing a binary called
But when I run it I get I'm suggesting that you define
with
I don't think that requires that you split your tests into different directories, or that your run some tests with post-processing and some without. But if that were necessary, it might be easier to define a separate command Again, maybe I don't understand your use case. |
Hmm I see.... |
@prologic in case you are not aware, https://github.com/rogpeppe/go-internal#testscript might do what you are looking for, since it supports regexp for matching the output. |
Hey 馃憢
Been using your package here to try to write some cli integration tests for my project box and am running into a few issues that I think could be solved by implementing support for filtering output with either regular expressions or glob patterns.
See for example Mercurial's test runner and the section on Filtering output
Would you consider adding this support? 馃
The text was updated successfully, but these errors were encountered: