aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 0880b51bc..e0458327a 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -1,5 +1,8 @@
1use std::fmt::Write; 1use std::fmt::Write;
2use std::path::{PathBuf}; 2use std::path::{PathBuf};
3use std::sync::Once;
4
5use flexi_logger::Logger;
3 6
4use ra_db::{SyntaxDatabase}; 7use ra_db::{SyntaxDatabase};
5use ra_syntax::ast::{self, AstNode}; 8use ra_syntax::ast::{self, AstNode};
@@ -22,7 +25,7 @@ fn infer_file(content: &str) -> String {
22 let func = source_binder::function_from_source(&db, file_id, fn_def) 25 let func = source_binder::function_from_source(&db, file_id, fn_def)
23 .unwrap() 26 .unwrap()
24 .unwrap(); 27 .unwrap();
25 let inference_result = func.infer(&db); 28 let inference_result = func.infer(&db).unwrap();
26 for (syntax_ptr, ty) in &inference_result.type_for { 29 for (syntax_ptr, ty) in &inference_result.type_for {
27 let node = syntax_ptr.resolve(&source_file); 30 let node = syntax_ptr.resolve(&source_file);
28 write!( 31 write!(
@@ -58,6 +61,8 @@ fn ellipsize(mut text: String, max_len: usize) -> String {
58 61
59#[test] 62#[test]
60pub fn infer_tests() { 63pub fn infer_tests() {
64 static INIT: Once = Once::new();
65 INIT.call_once(|| Logger::with_env().start().unwrap());
61 dir_tests(&test_data_dir(), &["."], |text, _path| infer_file(text)); 66 dir_tests(&test_data_dir(), &["."], |text, _path| infer_file(text));
62} 67}
63 68