aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-04-20 17:26:53 +0100
committerFlorian Diebold <[email protected]>2019-04-20 17:26:53 +0100
commit82751f8a4ae2f126f5bcc601521659445b1cc83a (patch)
tree08d33236442df682b14f6ba7880857be200e93bd /crates/ra_hir
parent4ad2e4ce4e88c809abc7a8006d306fb038eb2d18 (diff)
Add a simple test for str method completion
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty/tests.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 8d8a0eaaa..86f18b487 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -627,6 +627,28 @@ fn test(a: A) {
627} 627}
628 628
629#[test] 629#[test]
630fn infer_inherent_method_str() {
631 assert_snapshot_matches!(
632 infer(r#"
633#[lang = "str"]
634impl str {
635 fn foo(&self) -> i32 {}
636}
637
638fn test() {
639 "foo".foo();
640}
641"#),
642 @r###"
643[40; 44) 'self': &str
644[53; 55) '{}': ()
645[69; 89) '{ ...o(); }': ()
646[75; 80) '"foo"': &str
647[75; 86) '"foo".foo()': i32"###
648 );
649}
650
651#[test]
630fn infer_tuple() { 652fn infer_tuple() {
631 assert_snapshot_matches!( 653 assert_snapshot_matches!(
632 infer(r#" 654 infer(r#"