Adding tests
sender Build / Test Suite (pull_request) Failing after 41s
sender Build / Rustfmt (pull_request) Failing after 38s
sender Build / Check (pull_request) Failing after 27s
sender Build / build (pull_request) Failing after 42s
sender Build / Clippy (pull_request) Failing after 1m16s
sender Build / Test Suite (pull_request) Failing after 41s
sender Build / Rustfmt (pull_request) Failing after 38s
sender Build / Check (pull_request) Failing after 27s
sender Build / build (pull_request) Failing after 42s
sender Build / Clippy (pull_request) Failing after 1m16s
This commit is contained in:
@@ -74,3 +74,26 @@ pub fn parse_message(filepath: &str) -> Result<Message, std::io::Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn test_parse_message() {
|
||||||
|
let message_path = String::from("tests/message-0.json");
|
||||||
|
match super::parse_message(&message_path) {
|
||||||
|
Ok(message) => {
|
||||||
|
assert_eq!(false, message.content.is_empty(), "Content is empty");
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_numbers() {
|
||||||
|
let numbers_path = String::from("tests/numbers-0.json");
|
||||||
|
let contacts = super::parse_numbers(&numbers_path);
|
||||||
|
assert_eq!(false, contacts.is_empty(), "Should not be empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user