diff options
author | Edwin Cheng <[email protected]> | 2020-04-27 19:10:17 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-04-27 19:10:17 +0100 |
commit | 213d208e2d61576e104a9d5e003efc4ad1abc469 (patch) | |
tree | a9035ca97e12f301dc776c21018de1cf97ad0e80 /crates/ra_hir_ty/src/tests | |
parent | 6a5014329aecf73da81943216729ab64fa255368 (diff) |
Add test
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/macros.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 4f82ff702..ac5485bc9 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -643,6 +643,32 @@ mod clone { | |||
643 | } | 643 | } |
644 | 644 | ||
645 | #[test] | 645 | #[test] |
646 | fn infer_derive_clone_in_core() { | ||
647 | let (db, pos) = TestDB::with_position( | ||
648 | r#" | ||
649 | //- /main.rs crate:main deps:core | ||
650 | use core::S; | ||
651 | fn test() { | ||
652 | S.clone()<|>; | ||
653 | } | ||
654 | |||
655 | //- /lib.rs crate:core | ||
656 | #[prelude_import] | ||
657 | use clone::*; | ||
658 | mod clone { | ||
659 | trait Clone { | ||
660 | fn clone(&self) -> Self; | ||
661 | } | ||
662 | } | ||
663 | #[derive(Clone)] | ||
664 | pub struct S; | ||
665 | |||
666 | "#, | ||
667 | ); | ||
668 | assert_eq!("S", type_at_pos(&db, pos)); | ||
669 | } | ||
670 | |||
671 | #[test] | ||
646 | fn infer_derive_clone_with_params() { | 672 | fn infer_derive_clone_with_params() { |
647 | let (db, pos) = TestDB::with_position( | 673 | let (db, pos) = TestDB::with_position( |
648 | r#" | 674 | r#" |