file unittests
parent
0be23dfb43
commit
60eedef967
|
|
@ -118,22 +118,26 @@ pub async fn check_file(filename: &str, path: &str) -> Result<(), CustomError> {
|
|||
|
||||
|
||||
#[cfg(test)]
|
||||
mod files_unittest {
|
||||
mod files_unittests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn try_to_create_watcher() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn try_to_create_watcher() {
|
||||
let res = create_watcher("dep-file", "/home/user/monitor/runner-rs/tests/examples/").await;
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn try_to_create_invalid_watcher() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn try_to_create_invalid_watcher() {
|
||||
let res = create_watcher("invalid-file", "/path/to/the/hell").await;
|
||||
assert!(res.is_err());
|
||||
}
|
||||
#[test]
|
||||
fn check_existing_file() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn check_existing_file() {
|
||||
let res = check_file("dep-file", "/home/user/monitor/runner-rs/tests/examples/").await;
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn check_non_existing_file() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn check_non_existing_file() {
|
||||
let res = check_file("invalid-file", "/path/to/the/hell").await;
|
||||
assert!(res.is_err());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue