coreutils/tests/by-util/test_basenc.rs

34 lines
966 B
Rust
Raw Normal View History

2023-08-21 08:49:27 +00:00
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
2023-03-20 13:51:19 +00:00
use crate::common::util::TestScenario;
#[test]
fn test_z85_not_padded() {
// The z85 crate deviates from the standard in some cases; we have to catch those
new_ucmd!()
.args(&["--z85", "-d"])
.pipe_in("##########")
.fails()
.stderr_only("basenc: error: invalid input\n");
new_ucmd!()
.args(&["--z85"])
.pipe_in("123")
.fails()
.stderr_only("basenc: error: invalid input (length must be multiple of 4 characters)\n");
}
2024-01-05 20:15:26 +00:00
#[test]
fn test_invalid_input() {
let error_message = if cfg!(windows) {
2024-01-15 09:43:20 +00:00
"basenc: .: Permission denied\n"
2024-01-05 20:15:26 +00:00
} else {
"basenc: error: invalid input\n"
};
new_ucmd!()
.args(&["--base32", "."])
.fails()
.stderr_only(error_message);
}