diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests.rs | 11 |
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 | ||
40 | fn 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 | |||
40 | fn check_types(ra_fixture: &str) { | 49 | fn 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 | ||
48 | fn check_types_impl(ra_fixture: &str, display_source: bool) { | 57 | fn 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 | ||
88 | fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | 98 | fn 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(); |