Reorganise test code

This way I don't need to differentiate between tests for generated code
and tests for hand-written code.
This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:53 -04:00
1 parent bf488d2266
commit 60960612a3
6 files changed
+15 -16

No files matched your search

@@ -71,6 +71,3 @@ impl hash::Hash for CollectionRef {
hash::Hash::hash(&self.hash(), state) hash::Hash::hash(&self.hash(), state)
} }
} }
#[cfg(test)]
mod tests;
+10 -7
View File
@@ -13,22 +13,25 @@ extern crate lazy_static;
use glib::Error; use glib::Error;
// re-exports // code generated by gir
mod auto; mod auto;
pub use crate::auto::functions::*; pub use crate::auto::functions::*;
pub use crate::auto::*; pub use crate::auto::*;
mod repo; // handwritten code
#[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg(any(feature = "v2018_6", feature = "dox"))]
mod collection_ref; mod collection_ref;
mod repo;
#[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use crate::collection_ref::CollectionRef; pub use crate::collection_ref::*;
mod object_name; mod object_name;
pub use crate::object_name::ObjectName; pub use crate::object_name::*;
// public modules // tests
#[cfg(test)]
mod tests;
// prelude
pub mod prelude { pub mod prelude {
pub use crate::auto::traits::*; pub use crate::auto::traits::*;
pub use crate::repo::RepoExtManual; pub use crate::repo::RepoExtManual;
@@ -141,6 +141,3 @@ impl<O: IsA<Repo>> RepoExtManual for O {
} }
} }
} }
#[cfg(test)]
mod tests;
@@ -1,4 +1,4 @@
use super::*; use crate::CollectionRef;
use std::collections::hash_map::DefaultHasher; use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
+2
View File
@@ -0,0 +1,2 @@
mod collection_ref;
mod repo;
@@ -1,4 +1,4 @@
use super::*; use crate::Repo;
use crate::RepoMode; use crate::RepoMode;
#[test] #[test]
@@ -11,4 +11,4 @@ fn should_get_repo_mode_from_string() {
fn should_return_error_for_invalid_repo_mode_string() { fn should_return_error_for_invalid_repo_mode_string() {
let result = Repo::mode_from_string("invalid-repo-mode"); let result = Repo::mode_from_string("invalid-repo-mode");
assert!(result.is_err()); assert!(result.is_err());
} }