Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move summary module in cli. #2890

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
10 changes: 5 additions & 5 deletions packages/hurl/src/test.rs → packages/hurl/src/cli/summary.rs
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,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\
Expand All @@ -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\
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
Loading