aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorHirokazu Hata <[email protected]>2019-01-13 11:51:05 +0000
committerHirokazu Hata <[email protected]>2019-01-13 12:04:03 +0000
commit829f668bd7aeabcc7a44c5c02ef7152790dd297c (patch)
tree6a0014459ff32608adaabd3718cfc9c732444589 /crates/ra_hir
parent0199572a3d06ff66eeae85a2d2c9762996f0d2d8 (diff)
Add infer tuple test
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty/tests.rs12
-rw-r--r--crates/ra_hir/src/ty/tests/data/tuple.txt5
2 files changed, 17 insertions, 0 deletions
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) {
268 ); 268 );
269} 269}
270 270
271#[test]
272fn infer_tuple() {
273 check_inference(
274 r#"
275fn test() {
276 let a: (u32, &str) = (1, "a");
277}
278"#,
279 "tuple.txt",
280 );
281}
282
271fn infer(content: &str) -> String { 283fn infer(content: &str) -> String {
272 let (db, _, file_id) = MockDatabase::with_single_file(content); 284 let (db, _, file_id) = MockDatabase::with_single_file(content);
273 let source_file = db.source_file(file_id); 285 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 @@
1[11; 49) '{ ...a"); }': ()
2[21; 22) 'a': (u32, &str)
3[38; 46) '(1, "a")': (u32, &str)
4[39; 40) '1': u32
5[42; 45) '"a"': &str