diff options
author | Tom Barrett <spalf0@gmail.com> | 2019-08-15 11:39:58 -0500 |
---|---|---|
committer | Tom Barrett <spalf0@gmail.com> | 2019-08-15 11:39:58 -0500 |
commit | c79294e0bdd3f045e2de4215f71db262c6e94848 (patch) | |
tree | 1bca92ccdf3eae4f2f9937448778b607e9b42255 /tests | |
parent | 46b6a160c71473177bcd607103fae35e3468d463 (diff) |
basic test now includes relative path
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index efdb909..2a7b6e8 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -5,10 +5,11 @@ mod tests { use rsycle::main::{build_path, empty, list, restore, rsycle}; use std::fs; use std::path::{Component, PathBuf}; + use std::ffi::OsStr; - fn get_rsyclebin() -> PathBuf { + fn gen_rsyclebin(dir_name: &str) -> PathBuf { let mut rsyclebin = dirs::home_dir().unwrap(); - rsyclebin.push(".test_rsyclebin"); + rsyclebin.push(dir_name); if !rsyclebin.exists() { fs::create_dir(&rsyclebin).unwrap(); } @@ -16,11 +17,12 @@ mod tests { } #[test] - fn test_rsycle() { - let rsyclebin = get_rsyclebin(); - - let filename = "test_file".as_ref(); + fn test_basics() { + test_rsycle("test_file".as_ref(), gen_rsyclebin(".test_rsyclebin")); + test_rsycle("../test_file_relative".as_ref(), gen_rsyclebin(".test_rsyclebin_relative")); + } + fn test_rsycle(filename: &OsStr, rsyclebin: PathBuf) { let mut test_path: PathBuf = [Component::CurDir, Component::Normal(filename)] .iter() .collect(); |