mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
tests/env: add unsetting invalid variables test
This commit is contained in:
parent
3d74e7b452
commit
c44b5952b8
1 changed files with 15 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
// spell-checker:ignore (words) bamf chdir
|
||||
// spell-checker:ignore (words) bamf chdir rlimit prlimit
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use std::fs;
|
||||
|
@ -80,6 +80,20 @@ fn test_combined_file_set_unset() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unset_invalid_variables() {
|
||||
use uucore::display::Quotable;
|
||||
|
||||
// Cannot test input with \0 in it, since output will also contain \0. rlimit::prlimit fails
|
||||
// with this error: Error { kind: InvalidInput, message: "nul byte found in provided data" }
|
||||
for var in &["", "a=b"] {
|
||||
new_ucmd!().arg("-u").arg(var).run().stderr_only(format!(
|
||||
"env: cannot unset {}: Invalid argument",
|
||||
var.quote()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_name_value_pair() {
|
||||
let out = new_ucmd!().arg("FOO=bar").run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue