diff --git a/packages/hurl/src/cli/mod.rs b/packages/hurl/src/cli/mod.rs index f1c846c83..48026039b 100644 --- a/packages/hurl/src/cli/mod.rs +++ b/packages/hurl/src/cli/mod.rs @@ -19,7 +19,9 @@ mod error; mod interactive; mod logger; pub(crate) mod options; +mod summary; pub(crate) use self::error::CliError; pub(crate) use self::logger::BaseLogger; pub(crate) use self::options::OutputType; +pub(crate) use self::summary::summary; diff --git a/packages/hurl/src/test.rs b/packages/hurl/src/cli/summary.rs similarity index 94% rename from packages/hurl/src/test.rs rename to packages/hurl/src/cli/summary.rs index 6a2e04445..2057e0153 100644 --- a/packages/hurl/src/test.rs +++ b/packages/hurl/src/cli/summary.rs @@ -20,7 +20,7 @@ use crate::HurlRun; /// Returns the text summary of this Hurl `runs`. /// /// This is used in `--test`mode. -pub fn get_summary(runs: &[HurlRun], duration: u128) -> String { +pub fn summary(runs: &[HurlRun], duration: u128) -> String { let total_files = runs.len(); let total_requests = requests_count(runs); let success_files = runs.iter().filter(|r| r.hurl_result.success).count(); @@ -82,9 +82,9 @@ pub mod tests { let runs = vec![new_run(true, 10), new_run(true, 20), new_run(true, 4)]; let duration = 128; - let summary = get_summary(&runs, duration); + let s = summary(&runs, duration); assert_eq!( - summary, + s, "--------------------------------------------------------------------------------\n\ Executed files: 3\n\ Executed requests: 0\n\ @@ -95,9 +95,9 @@ pub mod tests { let runs = vec![new_run(true, 10), new_run(false, 10), new_run(true, 40)]; let duration = 200; - let summary = get_summary(&runs, duration); + let s = summary(&runs, duration); assert_eq!( - summary, + s, "--------------------------------------------------------------------------------\n\ Executed files: 3\n\ Executed requests: 0\n\ diff --git a/packages/hurl/src/main.rs b/packages/hurl/src/main.rs index b8992425c..0aec1e564 100644 --- a/packages/hurl/src/main.rs +++ b/packages/hurl/src/main.rs @@ -17,7 +17,6 @@ */ mod cli; mod run; -mod test; use std::io::prelude::*; use std::path::Path; @@ -106,7 +105,7 @@ fn main() { unwrap_or_exit(ret, EXIT_ERROR_UNDEFINED, &base_logger); if opts.test { - let summary = test::get_summary(&runs, duration); + let summary = cli::summary(&runs, duration); base_logger.info(summary.as_str()); }