1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

env: reject program with --null, error stderr

This commit is contained in:
Reto Habluetzel 2019-04-28 11:12:37 +02:00 committed by Reto Habluetzel
parent 75249e1e5d
commit 2d2042c8fc
3 changed files with 23 additions and 7 deletions

View file

@ -606,7 +606,7 @@ impl UCommand {
}
/// Spawns the command, feeds the stdin if any, waits for the result,
/// asserts success, and returns a command result.
/// asserts failure, and returns a command result.
pub fn fails(&mut self) -> CmdResult {
let cmd_result = self.run();
cmd_result.failure();

View file

@ -81,3 +81,9 @@ fn test_unset_variable() {
assert_eq!(out.lines().any(|line| line.starts_with("HOME=")), false);
}
#[test]
fn test_fail_null_with_program() {
let out = new_ucmd!().arg("--null").arg("cd").fails().stderr;
assert!(out.contains("cannot specify --null (-0) with command"));
}