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 2019-05-21 19:28:49 +02:00 committed by Colin Walters
parent bf488d2266
commit 60960612a3
6 changed files with 15 additions and 16 deletions

View File

@ -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;

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;

View File

@ -141,6 +141,3 @@ impl<O: IsA<Repo>> RepoExtManual for O {
} }
} }
} }
#[cfg(test)]
mod tests;

View File

@ -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};

View File

@ -0,0 +1,2 @@
mod collection_ref;
mod repo;

View File

@ -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());
} }