-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support using output of one command to match output of next #169
Comments
This isn't supported. If we do go this route, id recommend it be I do wonder if doing this in rust with |
I was looking at the snapbox docs, but the main value I'm getting out of |
Otherwise I think I'd have either of two options:
The holy grail would obviously be a rust tool (ie. something that integrates well with cargo) that doesn't force me to use string syntax inside .rs files for stdout tests; which trycmd is pretty close to, modulo some limitations. Curious to hear your thoughts. |
For me, I've found that I don't need the extra flexibility of assert_cmd and the output for snapbox is easier to read. I've switched all of my tests over to either snapbox or trycmd
The advantage of cram is that you can run do nearly everything because it runs in a shell. The downside is it isn't cross platform. The main challenge with trycmd is remaining cross platform. I will say being able to support these kinds of cases would be nice but my time is limited atm and my focus is elsewhere but I will review things people work on towards it. |
Do you have examples of using snapbox directly that I can look at? |
For typos, I use snapbox for codegen Cargo also has a lot of tests with snapbox, like for cargo add cargo edit similarly uses snapbox See also snapbox's dependents |
I was wondering if there was any functionality that would allow using command output to bind a variable, such that it could be used to test a subsequent command? For example, given a command to generate some key and list generated keys:
Generate two keys:
Then list all your keys:
One way I imagine this could work is if we could bind variables in the output, for example:
The first
[KEY1]
and[KEY2]
would bind new variables. The second[KEY1]
and[KEY2]
(in list-keys) would expect the value to equal the bound variables.Without any way to use command output in the test, it requires the tests to be implemented partly in rust and partly in
.md
files, which is cumbersome, whenever there is output that can't be known in advance.Thoughts? I'm happy to help implement something like this if it makes sense for this project.
The text was updated successfully, but these errors were encountered: