Move summary module in cli.

This commit is contained in:
Jean-Christophe Amiel 2024-06-07 14:40:39 +02:00
parent 48847abeaa
commit d0ce2a8573
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
3 changed files with 8 additions and 7 deletions

View File

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

View File

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

View File

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