Add some tests for Repo

This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:53 -04:00
1 parent cfcc97d5f7
commit 26b5729c53
2 files changed
+17

No files matched your search

@@ -140,3 +140,6 @@ impl<O: IsA<Repo> + IsA<glib::Object> + Clone + 'static> RepoExtManual for O {
}
}
}
#[cfg(test)]
mod tests;
+14
View File
@@ -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());
}