aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/tests')
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs48
1 files changed, 47 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index de3bd5bc5..152681062 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -208,7 +208,7 @@ pub use std::collections::HashMap;
208 "range": { 208 "range": {
209 "end": { 209 "end": {
210 "character": 0, 210 "character": 0,
211 "line": 6 211 "line": 7
212 }, 212 },
213 "start": { 213 "start": {
214 "character": 0, 214 "character": 0,
@@ -414,3 +414,49 @@ fn main() {{}}
414 let elapsed = start.elapsed(); 414 let elapsed = start.elapsed();
415 assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed); 415 assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed);
416} 416}
417
418#[test]
419fn preserves_dos_line_endings() {
420 let server = Project::with_fixture(
421 &"
422//- Cargo.toml
423[package]
424name = \"foo\"
425version = \"0.0.0\"
426
427//- src/main.rs
428/// Some Docs\r\nfn main() {}
429",
430 )
431 .server();
432
433 server.request::<OnEnter>(
434 TextDocumentPositionParams {
435 text_document: server.doc_id("src/main.rs"),
436 position: Position { line: 0, character: 8 },
437 },
438 json!({
439 "cursorPosition": {
440 "position": { "line": 1, "character": 4 },
441 "textDocument": { "uri": "file:///[..]src/main.rs" }
442 },
443 "label": "on enter",
444 "workspaceEdit": {
445 "documentChanges": [
446 {
447 "edits": [
448 {
449 "newText": "\r\n/// ",
450 "range": {
451 "end": { "line": 0, "character": 8 },
452 "start": { "line": 0, "character": 8 }
453 }
454 }
455 ],
456 "textDocument": { "uri": "file:///[..]src/main.rs", "version": null }
457 }
458 ]
459 }
460 }),
461 );
462}