Skip to content
Myr

ran cargo fmt

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Steve Nease · committed by David Peter · parent e38acdb · Browse files · 3 files+14 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−11 removed

  • tests:+8 added−8 removed
  • other:+6 added−3 removed

3 files+14 added−11 removed

modified:src/benchmark/executor.rs+3 added-1 removed
1use std::process::{ExitStatus, Stdio};23use crate::command::Command;4use crate::options::{CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell};4use crate::options::{5 CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell,6};7use crate::output::progress_bar::get_progress_bar;8use crate::timer::{execute_and_measure, TimerResult};9use crate::util::randomized_environment_offset;10use crate::util::units::Second;
289 unmodified lines
modified:src/options.rs+3 added-2 removed
229 unmodified lines
230 pub time_unit: Option<Unit>,231232 /// Where input to the benchmarked command comes from233 pub command_input_policy: CommandInputPolicy,234234}235236impl Default for Options {237 fn default() -> Options {
152 unmodified lines
390391 options.command_input_policy = if let Some(path_str) = matches.value_of("stdin-data") {392 let path = PathBuf::from(path_str);393 if !path.exists() {395 return Err(OptionsError::StdinDataFileDoesNotExist(path_str.to_string()))394 return Err(OptionsError::StdinDataFileDoesNotExist(395 path_str.to_string(),396 ));397 }398 CommandInputPolicy::File(path)399 } else {400 CommandInputPolicy::Null
62 unmodified lines
modified:tests/integration_tests.rs+8 added-8 removed
214 unmodified lines
215 );216}217218#[test]219fn can_pass_file_data_to_command_via_stdin(){219fn can_pass_file_data_to_command_via_stdin() {220 hyperfine()221 .arg("--runs=1")222 .arg("--stdin-data=example_stdin_data")223 .arg("--show-output")224 .arg("cat")225 .assert()226 .success()227 .stdout(228 predicate::str::contains("This data is passed to the command via stdin")229 );227 .stdout(predicate::str::contains(228 "This data is passed to the command via stdin",229 ));230}231232#[test]233fn fails_if_invalid_stdin_data_file_provided(){233fn fails_if_invalid_stdin_data_file_provided() {234 hyperfine()235 .arg("--runs=1")236 .arg("--stdin-data=example_stdin_data_invalid")237 .arg("--show-output")238 .arg("cat")239 .assert()240 .failure()241 .stderr(242 predicate::str::contains("File containing stdin data 'example_stdin_data_invalid' does not exist")243 );241 .stderr(predicate::str::contains(242 "File containing stdin data 'example_stdin_data_invalid' does not exist",243 ));244}245246#[test]247fn returns_mean_time_in_correct_unit() {
102 unmodified lines