Use CRLF as line ending in test files

This commit is contained in:
Quentin 2022-07-08 10:23:07 +02:00
parent aa6580e0c3
commit 9675cdb545
Signed by: quentin
GPG key ID: E9602264D639FF68
23 changed files with 744 additions and 728 deletions

View file

@ -851,7 +851,7 @@ mod tests {
for pref in prefixes.iter() { for pref in prefixes.iter() {
println!("{}", pref); println!("{}", pref);
let txt = fs::read(format!("{}.eml", pref))?; let txt = fs::read(format!("{}.eml", pref))?;
let exp = fs::read(format!("{}.body", pref))?; let exp = fs::read(format!("{}.dovecot.body", pref))?;
let message = Message::parse(&txt).unwrap(); let message = Message::parse(&txt).unwrap();
let mut resp = Vec::new(); let mut resp = Vec::new();
@ -864,6 +864,7 @@ mod tests {
let exp_str = String::from_utf8_lossy(exp_no_parenthesis).to_lowercase(); let exp_str = String::from_utf8_lossy(exp_no_parenthesis).to_lowercase();
println!("aerogramme: {}\ndovecot: {}", resp_str, exp_str); println!("aerogramme: {}\ndovecot: {}", resp_str, exp_str);
//println!("\n\n {} \n\n", String::from_utf8_lossy(&resp));
assert_eq!(resp_str, exp_str); assert_eq!(resp_str, exp_str);
} }

Binary file not shown.

15
tests/unix2dos.py Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import sys
buf = ""
with open(sys.argv[1], 'r+b') as f:
buf = f.read()
if buf.find(b'\r\n'):
print(f"{sys.argv[1]} is already a CRLF file")
sys.exit(1)
buf = buf.replace(b'\n', b'\r\n')
with open(sys.argv[1], 'w+b') as f:
f.write(buf)