coreutils/tests/by-util/test_timeout.rs
Michael Debertol c5d7cbda32 timeout: handle arguments for the command to run
To prevent clap from parsing flags for the command to run as flags for
timeout, remove the "args" positional argument, but allow to pass flags
via the "command" positional arg.
2021-06-10 17:03:32 +02:00

19 lines
580 B
Rust

use crate::common::util::*;
// FIXME: this depends on the system having true and false in PATH
// the best solution is probably to generate some test binaries that we can call for any
// utility that requires executing another program (kill, for instance)
#[test]
fn test_subcommand_return_code() {
new_ucmd!().arg("1").arg("true").succeeds();
new_ucmd!().arg("1").arg("false").run().status_code(1);
}
#[test]
fn test_command_with_args() {
new_ucmd!()
.args(&["1700", "echo", "-n", "abcd"])
.succeeds()
.stdout_only("abcd");
}