diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 17 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt | 10 |
2 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index fb53fcf0b..97c466890 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -153,6 +153,23 @@ impl S { | |||
153 | ); | 153 | ); |
154 | } | 154 | } |
155 | 155 | ||
156 | #[test] | ||
157 | fn infer_boolean_op() { | ||
158 | check_inference( | ||
159 | r#" | ||
160 | fn test() { | ||
161 | let x = a && b; | ||
162 | let y = true || false; | ||
163 | let z = x == y; | ||
164 | let h = CONST_1 <= CONST_2; | ||
165 | |||
166 | 10 < 3 | ||
167 | } | ||
168 | "#, | ||
169 | "0008_boolean_op.txt", | ||
170 | ); | ||
171 | } | ||
172 | |||
156 | fn infer(content: &str) -> String { | 173 | fn infer(content: &str) -> String { |
157 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 174 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
158 | let source_file = db.source_file(file_id); | 175 | let source_file = db.source_file(file_id); |
diff --git a/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt b/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt new file mode 100644 index 000000000..cc07cdccb --- /dev/null +++ b/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | [21; 22) 'x': bool | ||
2 | [68; 69) 'z': bool | ||
3 | [72; 78) 'x == y': bool | ||
4 | [45; 58) 'true || false': bool | ||
5 | [11; 125) '{ ... < 3 }': bool | ||
6 | [117; 123) '10 < 3': bool | ||
7 | [88; 89) 'h': bool | ||
8 | [41; 42) 'y': bool | ||
9 | [92; 110) 'CONST_...ONST_2': bool | ||
10 | [25; 31) 'a && b': bool | ||