aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/coercion.rs
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-07-20 17:38:52 +0100
committerLaurenČ›iu Nicola <[email protected]>2020-07-20 17:38:52 +0100
commit3b6979be77dcce37edd5f29607c5fd41252e312d (patch)
treec0d45f11daec8264432eead1c0edc0f6439f97d1 /crates/ra_hir_ty/src/tests/coercion.rs
parentb82899ad764502eab0ee1410afb42888bbd5099e (diff)
Use expect in never_type tests
Diffstat (limited to 'crates/ra_hir_ty/src/tests/coercion.rs')
-rw-r--r--crates/ra_hir_ty/src/tests/coercion.rs29
1 files changed, 2 insertions, 27 deletions
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/ra_hir_ty/src/tests/coercion.rs
index 7704774b7..823abddc6 100644
--- a/crates/ra_hir_ty/src/tests/coercion.rs
+++ b/crates/ra_hir_ty/src/tests/coercion.rs
@@ -1,32 +1,7 @@
1use expect::expect;
1use test_utils::mark; 2use test_utils::mark;
2 3
3use expect::{expect, Expect}; 4use super::{check_infer, check_infer_with_mismatches};
4
5// Infer with some common definitions and impls.
6fn check_infer(ra_fixture: &str, expect: Expect) {
7 let defs = r#"
8 #[lang = "sized"]
9 pub trait Sized {}
10 #[lang = "unsize"]
11 pub trait Unsize<T: ?Sized> {}
12 #[lang = "coerce_unsized"]
13 pub trait CoerceUnsized<T> {}
14
15 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
16 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
17 "#;
18
19 // Append to the end to keep positions unchanged.
20 let mut actual = super::infer(&format!("{}{}", ra_fixture, defs));
21 actual.push('\n');
22 expect.assert_eq(&actual);
23}
24
25fn check_infer_with_mismatches(ra_fixture: &str, expect: Expect) {
26 let mut actual = super::infer_with_mismatches(ra_fixture, true);
27 actual.push('\n');
28 expect.assert_eq(&actual);
29}
30 5
31#[test] 6#[test]
32fn infer_block_expr_type_mismatch() { 7fn infer_block_expr_type_mismatch() {