mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
hashsum: when the filename contains some special chars, escape them
Should fix tests/cksum/md5sum-newline.pl
This commit is contained in:
parent
746a7b14d0
commit
5e29c60b26
2 changed files with 28 additions and 1 deletions
|
@ -371,3 +371,18 @@ fn test_tag() {
|
|||
"SHA256 (foobar) = 1f2ec52b774368781bed1d1fb140a92e0eb6348090619c9291f9a5a3c8e8d151\n",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn test_with_escape_filename() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
||||
let at = &scene.fixtures;
|
||||
let filename = "a\nb";
|
||||
at.touch(filename);
|
||||
let result = scene.ccmd("md5sum").arg("--text").arg(filename).succeeds();
|
||||
let stdout = result.stdout_str();
|
||||
println!("stdout {}", stdout);
|
||||
assert!(stdout.starts_with('\\'));
|
||||
assert!(stdout.trim().ends_with("a\\nb"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue