Skip to content

Commit

Permalink
Move summary module in cli.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed Jun 7, 2024
1 parent 48847ab commit 1887185
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/hurl/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -82,7 +82,7 @@ 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 summary = summary(&runs, duration);
assert_eq!(
summary,
"--------------------------------------------------------------------------------\n\
Expand All @@ -95,7 +95,7 @@ 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 summary = summary(&runs, duration);
assert_eq!(
summary,
"--------------------------------------------------------------------------------\n\
Expand Down
3 changes: 1 addition & 2 deletions packages/hurl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
mod cli;
mod run;
mod test;

use std::io::prelude::*;
use std::path::Path;
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 1887185

Please sign in to comment.