Skip to content

Commit da4fca7

Browse files
committed
Logging
1 parent 738dcf0 commit da4fca7

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

codebook/tests/test_files.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn example_file_path(file: &str) -> String {
88

99
#[test]
1010
fn test_example_files_word_locations() {
11+
utils::init_logging();
1112
let files: Vec<(&str, Vec<SpellCheckResult>)> = vec![
1213
(
1314
"example.py",
@@ -106,6 +107,7 @@ fn test_example_files_word_locations() {
106107

107108
#[test]
108109
fn test_example_files() {
110+
utils::init_logging();
109111
let files = [
110112
("example.html", vec!["Spelin", "Wolrd", "sor"]),
111113
("example.py", vec!["Pthon", "Wolrd"]),

codebook/tests/test_rust.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use codebook::{SpellCheckResult, TextRange};
22

33
mod utils;
4-
use utils::init_logging;
54

65
#[test]
76
fn test_rust_simple() {
8-
init_logging();
7+
utils::init_logging();
98
let processor = utils::get_processor();
109
let sample_text = r#"
1110
fn calculat_user_age(bithDate: String) -> u32 {
@@ -27,7 +26,7 @@ fn test_rust_simple() {
2726

2827
#[test]
2928
fn test_rust_comment_location() {
30-
init_logging();
29+
utils::init_logging();
3130
let sample_rust = r#"
3231
// Comment with a typo: mment
3332
"#;
@@ -50,7 +49,7 @@ fn test_rust_comment_location() {
5049

5150
#[test]
5251
fn test_rust_struct() {
53-
init_logging();
52+
utils::init_logging();
5453
let sample_rust = r#"
5554
pub struct BadSpeler {
5655
/// Terrible spelling: dwnloader

codebook/tests/utils/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use codebook::CodeDictionary;
22
static EXTRA_WORDS: &'static [&'static str] = &["http", "https", "www", "viewport", "UTF"];
33

44
pub fn get_processor() -> CodeDictionary {
5-
let mut cdict = CodeDictionary::new("./tests/en_index.aff", "./tests/en_index.dic").unwrap();
5+
let dict = CodeDictionary::new("./tests/en_index.aff", "./tests/en_index.dic").unwrap();
66
for word in EXTRA_WORDS {
7-
cdict.add_to_dictionary(word);
7+
dict.add_to_dictionary(word);
88
}
9-
cdict
9+
dict
1010
}
1111

1212
pub fn init_logging() {

0 commit comments

Comments
 (0)