aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-12 21:20:36 +0100
committerGitHub <[email protected]>2020-07-12 21:20:36 +0100
commit39e049d2a1d7e0adbd9546f9e8124843443b31ce (patch)
treec4bd56eaa24b25db28d8f213bae39c3b47703c46 /crates/ra_hir_ty/src/tests.rs
parentab1ad19f552e1b11055ed60f87cc420871d902eb (diff)
parentd885f38011b6d4265b527744234b3c317fe86501 (diff)
Merge #5319
5319: Chalk upgrade r=flodiebold a=flodiebold - upgrade Chalk - make use of Chalk's `Unsize` impls, remove ours - use Chalk's built-in array type - search efficiently for impls for an int/float variable - output Chalk tracing logs in hir_ty tests Fixes #2534. Fixes #5057. Fixes #4374. Fixes #4281. Co-authored-by: Florian Diebold <[email protected]> Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 69f2d7667..27f5a60bf 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -37,6 +37,15 @@ use crate::{
37// against snapshots of the expected results using insta. Use cargo-insta to 37// against snapshots of the expected results using insta. Use cargo-insta to
38// update the snapshots. 38// update the snapshots.
39 39
40fn setup_tracing() -> tracing::subscriber::DefaultGuard {
41 use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};
42 use tracing_tree::HierarchicalLayer;
43 let filter = EnvFilter::from_env("CHALK_DEBUG");
44 let layer = HierarchicalLayer::default().with_indent_amount(2).with_writer(std::io::stderr);
45 let subscriber = Registry::default().with(filter).with(layer);
46 tracing::subscriber::set_default(subscriber)
47}
48
40fn check_types(ra_fixture: &str) { 49fn check_types(ra_fixture: &str) {
41 check_types_impl(ra_fixture, false) 50 check_types_impl(ra_fixture, false)
42} 51}
@@ -46,6 +55,7 @@ fn check_types_source_code(ra_fixture: &str) {
46} 55}
47 56
48fn check_types_impl(ra_fixture: &str, display_source: bool) { 57fn check_types_impl(ra_fixture: &str, display_source: bool) {
58 let _tracing = setup_tracing();
49 let db = TestDB::with_files(ra_fixture); 59 let db = TestDB::with_files(ra_fixture);
50 let mut checked_one = false; 60 let mut checked_one = false;
51 for (file_id, annotations) in db.extract_annotations() { 61 for (file_id, annotations) in db.extract_annotations() {
@@ -86,6 +96,7 @@ fn infer(ra_fixture: &str) -> String {
86} 96}
87 97
88fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { 98fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
99 let _tracing = setup_tracing();
89 let (db, file_id) = TestDB::with_single_file(content); 100 let (db, file_id) = TestDB::with_single_file(content);
90 101
91 let mut buf = String::new(); 102 let mut buf = String::new();