mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
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:
1 parent
531fee3188
commit
e38acdb683
6 files changed
+91
-3
No files matched your search
@@ -0,0 +1 @@
|
||||
This data is passed to the command via stdin
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user