test: Assert CRLF line endings on Windows
This commit is contained in:
parent
9d8f3812cc
commit
363363d066
2 changed files with 8 additions and 0 deletions
|
@ -1038,9 +1038,14 @@ mod unit_tests {
|
|||
#[test]
|
||||
fn test_format_snippet() {
|
||||
let snippet = "fn main() { println!(\"hello, world\"); }";
|
||||
#[cfg(not(windows))]
|
||||
let expected = "fn main() {\n \
|
||||
println!(\"hello, world\");\n\
|
||||
}\n";
|
||||
#[cfg(windows)]
|
||||
let expected = "fn main() {\r\n \
|
||||
println!(\"hello, world\");\r\n\
|
||||
}\r\n";
|
||||
assert!(test_format_inner(format_snippet, snippet, expected));
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,10 @@ fn stdin_formatting_smoke_test() {
|
|||
let (error_summary, _) = format_input(input, &config, Some(&mut buf)).unwrap();
|
||||
assert!(error_summary.has_no_errors());
|
||||
//eprintln!("{:?}", );
|
||||
#[cfg(not(windows))]
|
||||
assert_eq!(buf, "fn main() {}\n".as_bytes());
|
||||
#[cfg(windows)]
|
||||
assert_eq!(buf, "fn main() {}\r\n".as_bytes());
|
||||
}
|
||||
|
||||
// FIXME(#1990) restore this test
|
||||
|
|
Loading…
Reference in a new issue