i5-add-tests (part 3) #9

Merged
kemitix merged 28 commits from i5-add-tests into main 2023-07-29 20:36:04 +01:00
4 changed files with 8 additions and 5 deletions
Showing only changes of commit 87a53f8426 - Show all commits

4
src/file/mod.rs Normal file
View file

@ -0,0 +1,4 @@
mod env;
pub mod read;
pub use env::FileEnv;

View file

@ -27,7 +27,7 @@ mod tests {
//given
let (dir, file_name) = create_text_file(
"subscriptions.txt",
include_bytes!("../test/data/subscriptions.txt"),
include_bytes!("../../test/data/subscriptions.txt"),
)?;
let file_env = FileEnv::default();
@ -45,7 +45,7 @@ mod tests {
//given
let (dir, file_name) = create_text_file(
"subscriptions.txt",
include_bytes!("../test/data/subscriptions-blank-line.txt"),
include_bytes!("../../test/data/subscriptions-blank-line.txt"),
)?;
let file_env = FileEnv::default();
@ -63,7 +63,7 @@ mod tests {
//given
let (dir, file_name) = create_text_file(
"subscriptions.txt",
include_bytes!("../test/data/subscriptions-comment.txt"),
include_bytes!("../../test/data/subscriptions-comment.txt"),
)?;
let file_env = FileEnv::default();

View file

@ -4,7 +4,6 @@ pub mod fetch;
pub mod file;
pub mod history;
pub mod prelude;
mod subscriptions;
#[cfg(test)]
mod test_utils;
@ -23,7 +22,7 @@ pub struct Env {
}
pub fn run(subscriptions: &str, history: &str, site: &str, e: Env) -> Result<()> {
for channel_name in subscriptions::lines_from(subscriptions, &e.file)? {
for channel_name in file::read::lines_from(subscriptions, &e.file)? {
println!("Channel: {}", channel_name);
let feed_url = (e.feed.find)(site, &channel_name, &e.fetch.get)?;
for entry in (e.feed.get)(&feed_url)?.entries() {