diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 7 |
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 @@ | |||
1 | use std::fmt::Write; | 1 | use std::fmt::Write; |
2 | use std::path::{PathBuf}; | 2 | use std::path::{PathBuf}; |
3 | use std::sync::Once; | ||
4 | |||
5 | use flexi_logger::Logger; | ||
3 | 6 | ||
4 | use ra_db::{SyntaxDatabase}; | 7 | use ra_db::{SyntaxDatabase}; |
5 | use ra_syntax::ast::{self, AstNode}; | 8 | use 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] |
60 | pub fn infer_tests() { | 63 | pub 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 | ||