Split lib.rs into smaller files #115
@ -66,7 +66,7 @@ mod tests {
|
|||||||
|
|
||||||
use mockall::predicate;
|
use mockall::predicate;
|
||||||
|
|
||||||
use crate::{testlib::FULL_COLLECTION, Artist, ArtistId, Collection};
|
use crate::{musichoard::testmod::FULL_COLLECTION, Artist, ArtistId, Collection};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use testmod::DATABASE_JSON;
|
use testmod::DATABASE_JSON;
|
||||||
|
@ -22,6 +22,7 @@ pub use collection::{
|
|||||||
// FIXME: validate the re-exports
|
// FIXME: validate the re-exports
|
||||||
pub use musichoard::{MusicHoard, MusicHoardBuilder, NoDatabase, NoLibrary};
|
pub use musichoard::{MusicHoard, MusicHoardBuilder, NoDatabase, NoLibrary};
|
||||||
|
|
||||||
|
// FIXME: this should be in the musichoard module.
|
||||||
/// Error type for `musichoard`.
|
/// Error type for `musichoard`.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
@ -89,7 +90,4 @@ impl From<InvalidUrlError> for Error {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod testmacros;
|
mod tests;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod testlib;
|
|
||||||
|
@ -128,7 +128,4 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod testmacros;
|
mod tests;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod testbin;
|
|
||||||
|
@ -372,5 +372,8 @@ impl<LIB, DB> MusicHoardBuilder<LIB, DB> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod testmod;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -5,5 +5,7 @@ use crate::collection::{
|
|||||||
};
|
};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
use crate::tests::*;
|
||||||
|
|
||||||
pub static LIBRARY_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| library_collection!());
|
pub static LIBRARY_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| library_collection!());
|
||||||
pub static FULL_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());
|
pub static FULL_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());
|
@ -2,6 +2,8 @@ use mockall::predicate;
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
use super::testmod::{FULL_COLLECTION, LIBRARY_COLLECTION};
|
||||||
|
|
||||||
// FIXME: check all crate::* imports - are the tests where they should be?
|
// FIXME: check all crate::* imports - are the tests where they should be?
|
||||||
use crate::collection::{
|
use crate::collection::{
|
||||||
artist::{ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz},
|
artist::{ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz},
|
||||||
@ -10,7 +12,6 @@ use crate::collection::{
|
|||||||
};
|
};
|
||||||
use crate::database::{self, MockIDatabase};
|
use crate::database::{self, MockIDatabase};
|
||||||
use crate::library::{self, testmod::LIBRARY_ITEMS, MockILibrary};
|
use crate::library::{self, testmod::LIBRARY_ITEMS, MockILibrary};
|
||||||
use crate::testlib::{FULL_COLLECTION, LIBRARY_COLLECTION};
|
|
||||||
|
|
||||||
static MUSICBRAINZ: &str = "https://musicbrainz.org/artist/d368baa8-21ca-4759-9731-0b2753071ad8";
|
static MUSICBRAINZ: &str = "https://musicbrainz.org/artist/d368baa8-21ca-4759-9731-0b2753071ad8";
|
||||||
static MUSICBRAINZ_2: &str = "https://musicbrainz.org/artist/823869a5-5ded-4f6b-9fb7-2a9344d83c6b";
|
static MUSICBRAINZ_2: &str = "https://musicbrainz.org/artist/823869a5-5ded-4f6b-9fb7-2a9344d83c6b";
|
||||||
|
@ -321,3 +321,6 @@ macro_rules! full_collection {
|
|||||||
collection
|
collection
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) use full_collection;
|
||||||
|
pub(crate) use library_collection;
|
@ -157,6 +157,9 @@ impl<B: Backend, UI: IUi> Tui<B, UI> {
|
|||||||
// GRCOV_EXCL_STOP
|
// GRCOV_EXCL_STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod testmod;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{io, thread};
|
use std::{io, thread};
|
||||||
@ -164,7 +167,7 @@ mod tests {
|
|||||||
use musichoard::Collection;
|
use musichoard::Collection;
|
||||||
use ratatui::{backend::TestBackend, Terminal};
|
use ratatui::{backend::TestBackend, Terminal};
|
||||||
|
|
||||||
use crate::testbin::COLLECTION;
|
use super::testmod::COLLECTION;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
event::EventError,
|
event::EventError,
|
||||||
|
@ -4,4 +4,6 @@ use musichoard::{
|
|||||||
};
|
};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
use crate::tests::*;
|
||||||
|
|
||||||
pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());
|
pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());
|
@ -733,8 +733,8 @@ impl<MH: IMusicHoard> IUi for Ui<MH> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::testbin::COLLECTION;
|
|
||||||
use crate::tui::lib::MockIMusicHoard;
|
use crate::tui::lib::MockIMusicHoard;
|
||||||
|
use crate::tui::testmod::COLLECTION;
|
||||||
use crate::tui::tests::{terminal, ui};
|
use crate::tui::tests::{terminal, ui};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
Loading…
Reference in New Issue
Block a user