diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 920188fc9..8aacb1a7f 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -133,6 +133,32 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { | |||
133 | } | 133 | } |
134 | 134 | ||
135 | #[test] | 135 | #[test] |
136 | fn infer_literals() { | ||
137 | check_inference( | ||
138 | r##" | ||
139 | fn test() { | ||
140 | 5i32; | ||
141 | "hello"; | ||
142 | b"bytes"; | ||
143 | 'c'; | ||
144 | b'b'; | ||
145 | 3.14; | ||
146 | 5000; | ||
147 | false; | ||
148 | true; | ||
149 | r#" | ||
150 | //! doc | ||
151 | // non-doc | ||
152 | mod foo {} | ||
153 | "#; | ||
154 | br#"yolo"#; | ||
155 | } | ||
156 | "##, | ||
157 | "literals.txt", | ||
158 | ); | ||
159 | } | ||
160 | |||
161 | #[test] | ||
136 | fn infer_backwards() { | 162 | fn infer_backwards() { |
137 | check_inference( | 163 | check_inference( |
138 | r#" | 164 | r#" |
@@ -180,7 +206,7 @@ fn f(x: bool) -> i32 { | |||
180 | 0i32 | 206 | 0i32 |
181 | } | 207 | } |
182 | 208 | ||
183 | fn test() { | 209 | fn test() -> bool { |
184 | let x = a && b; | 210 | let x = a && b; |
185 | let y = true || false; | 211 | let y = true || false; |
186 | let z = x == y; | 212 | let z = x == y; |
@@ -277,8 +303,6 @@ fn test(x: &str, y: isize) { | |||
277 | let b = (a, x); | 303 | let b = (a, x); |
278 | let c = (y, x); | 304 | let c = (y, x); |
279 | let d = (c, x); | 305 | let d = (c, x); |
280 | |||
281 | // we have not infered these case yet. | ||
282 | let e = (1, "e"); | 306 | let e = (1, "e"); |
283 | let f = (e, "d"); | 307 | let f = (e, "d"); |
284 | } | 308 | } |