fixup! hashsum: fix handling of \r\n in Windows text mode

This commit is contained in:
Jeffrey Finkelstein 2021-10-11 18:18:29 -04:00
parent c50b5ac110
commit d1e02665bf

View file

@ -297,15 +297,15 @@ mod tests {
// Writing "\r" in one call to `write()`, and then "\n" in another.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>;
let mut writer_crlf = DigestWriter::new(&mut digest, false);
writer_crlf.write(&[b'\r']).unwrap();
writer_crlf.write(&[b'\n']).unwrap();
writer_crlf.write_all(&[b'\r']).unwrap();
writer_crlf.write_all(&[b'\n']).unwrap();
writer_crlf.finalize();
let result_crlf = digest.result_str();
// We expect "\r\n" to be replaced with "\n" in text mode on Windows.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>;
let mut writer_lf = DigestWriter::new(&mut digest, false);
writer_lf.write(&[b'\n']).unwrap();
writer_lf.write_all(&[b'\n']).unwrap();
writer_lf.finalize();
let result_lf = digest.result_str();