From 26b5729c536eba97402acd14292d9b1593a70235 Mon Sep 17 00:00:00 2001 From: Felix Krull Date: Sat, 18 May 2019 16:13:54 +0200 Subject: [PATCH] Add some tests for Repo --- rust-bindings/rust/src/{repo.rs => repo/mod.rs} | 3 +++ rust-bindings/rust/src/repo/tests.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+) rename rust-bindings/rust/src/{repo.rs => repo/mod.rs} (99%) create mode 100644 rust-bindings/rust/src/repo/tests.rs diff --git a/rust-bindings/rust/src/repo.rs b/rust-bindings/rust/src/repo/mod.rs similarity index 99% rename from rust-bindings/rust/src/repo.rs rename to rust-bindings/rust/src/repo/mod.rs index 5ed83786..1245496c 100644 --- a/rust-bindings/rust/src/repo.rs +++ b/rust-bindings/rust/src/repo/mod.rs @@ -140,3 +140,6 @@ impl + IsA + Clone + 'static> RepoExtManual for O { } } } + +#[cfg(test)] +mod tests; diff --git a/rust-bindings/rust/src/repo/tests.rs b/rust-bindings/rust/src/repo/tests.rs new file mode 100644 index 00000000..de388120 --- /dev/null +++ b/rust-bindings/rust/src/repo/tests.rs @@ -0,0 +1,14 @@ +use super::*; +use crate::RepoMode; + +#[test] +fn should_get_repo_mode_from_string() { + let mode = Repo::mode_from_string("archive").unwrap(); + assert_eq!(RepoMode::Archive, mode); +} + +#[test] +fn should_return_error_for_invalid_repo_mode_string() { + let result = Repo::mode_from_string("invalid-repo-mode"); + assert!(result.is_err()); +} \ No newline at end of file