diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 515c66e85..25a354947 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -156,6 +156,30 @@ impl S { | |||
156 | ); | 156 | ); |
157 | } | 157 | } |
158 | 158 | ||
159 | #[test] | ||
160 | fn infer_boolean_op() { | ||
161 | check_inference( | ||
162 | r#" | ||
163 | fn f(x: bool) -> i32 { | ||
164 | 0i32 | ||
165 | } | ||
166 | |||
167 | fn test() { | ||
168 | let x = a && b; | ||
169 | let y = true || false; | ||
170 | let z = x == y; | ||
171 | let h = CONST_1 <= CONST_2; | ||
172 | let c = f(z || y) + 5; | ||
173 | let d = b; | ||
174 | let e = 3i32 && "hello world"; | ||
175 | |||
176 | 10 < 3 | ||
177 | } | ||
178 | "#, | ||
179 | "0008_boolean_op.txt", | ||
180 | ); | ||
181 | } | ||
182 | |||
159 | fn infer(content: &str) -> String { | 183 | fn infer(content: &str) -> String { |
160 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 184 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
161 | let source_file = db.source_file(file_id); | 185 | let source_file = db.source_file(file_id); |