From de3f2948ea2416d65640c07d2c69df75a4273d50 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Aug 2019 18:26:07 +0300 Subject: add tests for crlf --- crates/ra_lsp_server/tests/heavy_tests/main.rs | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'crates/ra_lsp_server/tests/heavy_tests') diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index de3bd5bc5..ec075a2fd 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -414,3 +414,49 @@ fn main() {{}} let elapsed = start.elapsed(); assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed); } + +#[test] +fn preserves_dos_line_endings() { + let server = Project::with_fixture( + &r#" +//- Cargo.toml +[package] +name = "foo" +version = "0.0.0" + +//- src/main.rs +/// Some Docs\r\nfn main() {} +"#, + ) + .server(); + + server.request::( + TextDocumentPositionParams { + text_document: server.doc_id("src/main.rs"), + position: Position { line: 0, character: 8 }, + }, + json!({ + "cursorPosition": { + "position": { "line": 1, "character": 4 }, + "textDocument": { "uri": "file:///[..]src/main.rs" } + }, + "label": "on enter", + "workspaceEdit": { + "documentChanges": [ + { + "edits": [ + { + "newText": "\r\n/// ", + "range": { + "end": { "line": 0, "character": 8 }, + "start": { "line": 0, "character": 8 } + } + } + ], + "textDocument": { "uri": "file:///[..]src/main.rs", "version": null } + } + ] + } + }), + ); +} -- cgit v1.2.3