1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 03:26:18 +00:00

Merge pull request #6050 from matrixhead/main

dd : treat arg as bytes if it contains a 'B'
This commit is contained in:
Terts Diepraam 2024-03-10 12:52:29 +01:00 committed by GitHub
commit a578fe9e55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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]