mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
base64: in tests, test both option forms
This commit is contained in:
parent
1c1cf2446e
commit
2bad30b2b0
1 changed files with 25 additions and 20 deletions
|
@ -18,13 +18,15 @@ fn test_encode() {
|
|||
|
||||
#[test]
|
||||
fn test_decode() {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "aGVsbG8sIHdvcmxkIQ==";
|
||||
let result = ucmd.arg("-d").run_piped_stdin(input.as_bytes());
|
||||
for decode_param in vec!["-d", "--decode"] {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "aGVsbG8sIHdvcmxkIQ==";
|
||||
let result = ucmd.arg(decode_param).run_piped_stdin(input.as_bytes());
|
||||
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout, "hello, world!");
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout, "hello, world!");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -40,23 +42,26 @@ fn test_garbage() {
|
|||
|
||||
#[test]
|
||||
fn test_ignore_garbage() {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "aGVsbG8sIHdvcmxkIQ==\0";
|
||||
let result = ucmd.arg("-d").arg("-i").run_piped_stdin(input.as_bytes());
|
||||
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout, "hello, world!");
|
||||
for ignore_garbage_param in vec!["-i", "--ignore-garbage"] {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "aGVsbG8sIHdvcmxkIQ==\0";
|
||||
let result = ucmd.arg("-d").arg(ignore_garbage_param).run_piped_stdin(input.as_bytes());
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout, "hello, world!");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_wrap() {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "The quick brown fox jumps over the lazy dog.";
|
||||
let result = ucmd.arg("-w").arg("20").run_piped_stdin(input.as_bytes());
|
||||
for wrap_param in vec!["-w", "--wrap"] {
|
||||
let (_, mut ucmd) = testing(UTIL_NAME);
|
||||
let input = "The quick brown fox jumps over the lazy dog.";
|
||||
let result = ucmd.arg(wrap_param).arg("20").run_piped_stdin(input.as_bytes());
|
||||
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout,
|
||||
"VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n");
|
||||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stdout,
|
||||
"VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue