From 82751f8a4ae2f126f5bcc601521659445b1cc83a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 20 Apr 2019 18:26:53 +0200 Subject: Add a simple test for str method completion --- crates/ra_hir/src/ty/tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/ra_hir') 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 @@ -626,6 +626,28 @@ fn test(a: A) { ); } +#[test] +fn infer_inherent_method_str() { + assert_snapshot_matches!( + infer(r#" +#[lang = "str"] +impl str { + fn foo(&self) -> i32 {} +} + +fn test() { + "foo".foo(); +} +"#), + @r###" +[40; 44) 'self': &str +[53; 55) '{}': () +[69; 89) '{ ...o(); }': () +[75; 80) '"foo"': &str +[75; 86) '"foo".foo()': i32"### + ); +} + #[test] fn infer_tuple() { assert_snapshot_matches!( -- cgit v1.2.3