mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tests/env: add unsetting invalid variables test
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user