Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit f9e0930

Browse files
committed
Fix reformat_with_range test in CI for Windows
Files in checkout have EOL changed from LF to CRLF, see https://travis-ci.community/t/files-in-checkout-have-eol-changed-from-lf-to-crlf/349.
1 parent f024cdb commit f9e0930

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/test/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,11 @@ fn test_reformat_with_range() {
796796
ls_server::LsService::handle_message(&mut server),
797797
ls_server::ServerStateChange::Continue
798798
);
799+
let newline = if cfg!(windows) { r#"\r\n"# } else { r#"\n"# };
800+
let formatted = r#"newText":"// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\npub fn main() {\n let world1 = \"world\";\n println!(\"Hello, {}!\", world1);\n let world2 = \"world\";\n println!(\"Hello, {}!\", world2);\n let world3 = \"world\";\n println!(\"Hello, {}!\", world3);\n}\n"#;
799801
expect_message(&mut server, results,
800802
ExpectedMessage::new(Some(42)).expect_contains(r#"{"start":{"line":0,"character":0},"end":{"line":15,"character":5}}"#)
801-
.expect_contains(r#"newText":"// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\npub fn main() {\n let world1 = \"world\";\n println!(\"Hello, {}!\", world1);\n let world2 = \"world\";\n println!(\"Hello, {}!\", world2);\n let world3 = \"world\";\n println!(\"Hello, {}!\", world3);\n}\n"#)
803+
.expect_contains(&formatted.replace(r#"\n"#, newline))
802804
);
803805
}
804806

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
newline_style = "Unix"
1+
# Work around Travis checking files out with autocrlf=true
2+
# https://travis-ci.community/t/files-in-checkout-have-eol-changed-from-lf-to-crlf/349
3+
newline_style = "Native"
24

0 commit comments

Comments
 (0)