From 829f668bd7aeabcc7a44c5c02ef7152790dd297c Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Sun, 13 Jan 2019 20:51:05 +0900 Subject: Add infer tuple test --- crates/ra_hir/src/ty/tests.rs | 12 ++++++++++++ crates/ra_hir/src/ty/tests/data/tuple.txt | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 crates/ra_hir/src/ty/tests/data/tuple.txt (limited to 'crates') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 1c3129441..4031cd735 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -268,6 +268,18 @@ fn test(a: A) { ); } +#[test] +fn infer_tuple() { + check_inference( + r#" +fn test() { + let a: (u32, &str) = (1, "a"); +} +"#, + "tuple.txt", + ); +} + fn infer(content: &str) -> String { let (db, _, file_id) = MockDatabase::with_single_file(content); let source_file = db.source_file(file_id); diff --git a/crates/ra_hir/src/ty/tests/data/tuple.txt b/crates/ra_hir/src/ty/tests/data/tuple.txt new file mode 100644 index 000000000..daf0bf560 --- /dev/null +++ b/crates/ra_hir/src/ty/tests/data/tuple.txt @@ -0,0 +1,5 @@ +[11; 49) '{ ...a"); }': () +[21; 22) 'a': (u32, &str) +[38; 46) '(1, "a")': (u32, &str) +[39; 40) '1': u32 +[42; 45) '"a"': &str -- cgit v1.2.3