You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example on the output extension page is a trivial example. How did it get an Output again? Oh it's a std type.
Okay I had a StdinCommand, or was it a Result<StdinCommand>.
Oh man. I have successfully been confused.
Let's open many tabs.
No wait let's open an issue.
There's a lot of jumping around trying to figure out "what type do I have, is it a Builder, a Result, a normal type by extended by some trait". Also, the Result's errors aren't all the same type (and aren't convertible), so I can't easily go main_binary()? and then later on .output()?.assert().success().
I think we need an example on the first page (and perhaps README.md) that does a complete test. The piecewise explanations are good on their own, but it's hard to tie them together. That is, literally every method call gives me a different type:
externcrate assert_cmd;use assert_cmd::{cargo::CargoError, prelude::*};use std::process::Command;#[test]fnintegration_test() -> Result<(),CargoError>{Command::main_binary()?
.env("APP_VAR","value")// https://doc.rust-lang.org/std/process/struct.Command.html#method.env.with_stdin()// https://docs.rs/assert_cmd/0.9.1/assert_cmd/trait.CommandStdInExt.html.buffer("exit\n")// https://docs.rs/assert_cmd/0.9.1/assert_cmd/struct.StdInCommandBuilder.html#method.buffer.output()// https://docs.rs/assert_cmd/0.9.1/assert_cmd/struct.StdInCommand.html#method.output.unwrap()// Gives you back the `Output`.assert()// https://docs.rs/assert_cmd/0.9.1/assert_cmd/assert/trait.OutputAssertExt.html#tymethod.assert.success();// https://docs.rs/assert_cmd/0.9.1/assert_cmd/assert/struct.Assert.html#method.successOk(())}
FWIW I was trying to port this test over:
let environment =
assert_cli::Environment::inherit().insert("APP_DIR",env!("CARGO_MANIFEST_DIR"));
assert_cli::Assert::main_binary().with_env(&environment).stdin("exit\n").unwrap();
Off topic, CONTRIBUTING.md looks like it might have been copied from something called stager.
The text was updated successfully, but these errors were encountered:
Hiya! I've appeared here since
assert_cli
is deprecated, and tried swapping over fromassert_cli 0.6
toassert_cmd 0.9
My really short experience (so far) has been something like this:
assert_cli
toassert_cmd
in the importsCommand
s fromstd
are extended by traits, cool!std
, okay it's there.stdin
? Searched and foundCommandStdInExt
..with_stdin().buffer("..").unwrap()
? Why can't I call.buffer("")
twice? Oh we're no longer the builder.unwrap()
the assertion? No wait it just gives me theStdinCommand
OutputAssertExt
.Output
again? Oh it's astd
type.StdinCommand
, or was it aResult<StdinCommand>
.There's a lot of jumping around trying to figure out "what type do I have, is it a
Builder
, aResult
, a normal type by extended by some trait". Also, theResult
's errors aren't all the same type (and aren't convertible), so I can't easily gomain_binary()?
and then later on.output()?.assert().success()
.I think we need an example on the first page (and perhaps
README.md
) that does a complete test. The piecewise explanations are good on their own, but it's hard to tie them together. That is, literally every method call gives me a different type:FWIW I was trying to port this test over:
Off topic, CONTRIBUTING.md looks like it might have been copied from something called
stager
.The text was updated successfully, but these errors were encountered: