-
Notifications
You must be signed in to change notification settings - Fork 41
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
Document how to use assert_cmd with rust-cross #139
Comments
Thanks for providing an example on how to do this. This will be good to add to the docs here and for trycmd |
I wonder, has this changed at all? I'm struggling to get my integration tests running with When running under cross for Experimenting with adding the prefix manually, the following do not work: What does work is Hence I ask, what is the best way to handle this case at present? |
@mfreeborn, can you try if the following works for you? I think the values of fn find_runner() -> Option<String> {
for (key, value) in std::env::vars() {
if key.starts_with("CARGO_TARGET_") && key.ends_with("_RUNNER") && !value.is_empty() {
return Some(value);
}
}
None
}
fn get_base_command() -> Command {
let mut cmd;
let path = assert_cmd::cargo::cargo_bin("xh");
if let Some(runner) = find_runner() {
let mut runner = runner.split_whitespace();
cmd = Command::new(runner.next().unwrap());
for arg in runner {
cmd.arg(arg);
}
cmd.arg(path);
} else {
cmd = Command::new(path);
}
cmd
} |
I can confirm that is working - thanks very much! |
Thank you for helping me find this method. Please document it for future reference. |
and how to not change anything to run with cross close: assert-rs#139
don't run the mod_example test when using cross it depends on escargot also supporting cross, which it doesn't at this time document the runner configuration usage and how to not change anything to run with cross close: assert-rs#139
don't run the mod_example test when using cross it depends on escargot also supporting cross, which it doesn't at this time document the runner configuration usage and how to not change anything to run with cross close: assert-rs#139
don't run the mod_example test when using cross it depends on escargot also supporting cross, which it doesn't at this time document the runner configuration usage and how to not change anything to run with cross close: assert-rs#139
It would be nice to mention that when running tests in
cross
, one needs to prepend their command with the value contained inCARGO_TARGET_*_RUNNER
i.eqemu-aarch64 xh
Also, see ducaale/xh#190 (comment)
The text was updated successfully, but these errors were encountered: