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