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

dd: treat arg as bytes if it contains 'B'

This commit is contained in:
mhead 2024-03-10 01:38:50 +05:30
parent b34d410ade
commit 1819cdee3b
2 changed files with 43 additions and 3 deletions

View file

@ -1405,6 +1405,36 @@ fn test_bytes_suffix() {
.stdout_only("\0\0\0abcdef");
}
#[test]
// the recursive nature of the suffix allows any string with a 'B' in it treated as bytes.
fn test_bytes_suffix_recursive() {
new_ucmd!()
.args(&["count=2Bx2", "status=none"])
.pipe_in("abcdef")
.succeeds()
.stdout_only("abcd");
new_ucmd!()
.args(&["skip=2Bx2", "status=none"])
.pipe_in("abcdef")
.succeeds()
.stdout_only("ef");
new_ucmd!()
.args(&["iseek=2Bx2", "status=none"])
.pipe_in("abcdef")
.succeeds()
.stdout_only("ef");
new_ucmd!()
.args(&["seek=2Bx2", "status=none"])
.pipe_in("abcdef")
.succeeds()
.stdout_only("\0\0\0\0abcdef");
new_ucmd!()
.args(&["oseek=2Bx2", "status=none"])
.pipe_in("abcdef")
.succeeds()
.stdout_only("\0\0\0\0abcdef");
}
/// Test for "conv=sync" with a slow reader.
#[cfg(not(windows))]
#[test]