Added --stdin-data argument

This argument accepts a path to a file. The data contained in the file will be passed to the command via stdin.

Closes sharkdp/hyperfine#541
This commit is contained in:
Steve Nease authored and David Peter committed 2023-03-15 09:33:49 +01:00
1 parent 531fee3188
commit e38acdb683
6 files changed
+91 -3

No files matched your search

+28
View File
@@ -215,6 +215,34 @@ fn runs_commands_using_user_defined_shell() {
);
}
#[test]
fn can_pass_file_data_to_command_via_stdin(){
hyperfine()
.arg("--runs=1")
.arg("--stdin-data=example_stdin_data")
.arg("--show-output")
.arg("cat")
.assert()
.success()
.stdout(
predicate::str::contains("This data is passed to the command via stdin")
);
}
#[test]
fn fails_if_invalid_stdin_data_file_provided(){
hyperfine()
.arg("--runs=1")
.arg("--stdin-data=example_stdin_data_invalid")
.arg("--show-output")
.arg("cat")
.assert()
.failure()
.stderr(
predicate::str::contains("File containing stdin data 'example_stdin_data_invalid' does not exist")
);
}
#[test]
fn returns_mean_time_in_correct_unit() {
hyperfine_debug()