diff options
author | Emil Lauridsen <[email protected]> | 2019-11-19 16:40:38 +0000 |
---|---|---|
committer | Emil Lauridsen <[email protected]> | 2019-11-19 16:40:38 +0000 |
commit | bf5ac4fe3952ee0db9fe18a185e39a209c58e79b (patch) | |
tree | 7dab95d6338657bb7b222cd8402b19c923a3f5cd | |
parent | dadad36bb9770f9b13ed84bc219ea0168a7a5bf1 (diff) |
Add test for inlay hint truncation
-rw-r--r-- | crates/ra_ide_api/src/inlay_hints.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index 6cd492b2a..24a7ca5e7 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs | |||
@@ -514,4 +514,41 @@ fn main() { | |||
514 | "### | 514 | "### |
515 | ); | 515 | ); |
516 | } | 516 | } |
517 | |||
518 | #[test] | ||
519 | fn hint_truncation() { | ||
520 | let (analysis, file_id) = single_file( | ||
521 | r#" | ||
522 | struct Smol<T>(T); | ||
523 | |||
524 | struct VeryLongOuterName<T>(T); | ||
525 | |||
526 | fn main() { | ||
527 | let a = Smol(0u32); | ||
528 | let b = VeryLongOuterName(0usize); | ||
529 | let c = Smol(Smol(0u32)) | ||
530 | }"#, | ||
531 | ); | ||
532 | |||
533 | assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8)).unwrap(), @r###" | ||
534 | [ | ||
535 | InlayHint { | ||
536 | range: [74; 75), | ||
537 | kind: TypeHint, | ||
538 | label: "Smol<u32>", | ||
539 | }, | ||
540 | InlayHint { | ||
541 | range: [98; 99), | ||
542 | kind: TypeHint, | ||
543 | label: "VeryLongOuterName<…>", | ||
544 | }, | ||
545 | InlayHint { | ||
546 | range: [137; 138), | ||
547 | kind: TypeHint, | ||
548 | label: "Smol<Smol<…>>", | ||
549 | }, | ||
550 | ] | ||
551 | "### | ||
552 | ); | ||
553 | } | ||
517 | } | 554 | } |