2022-02-06 12:06:27 +01:00
|
|
|
mod common;
|
|
|
|
|
use common::hyperfine;
|
2021-08-23 21:48:31 +02:00
|
|
|
|
2022-02-06 12:15:09 +01:00
|
|
|
use predicates::prelude::*;
|
|
|
|
|
|
2021-08-23 21:48:31 +02:00
|
|
|
#[test]
|
|
|
|
|
fn hyperfine_runs_successfully() {
|
|
|
|
|
hyperfine()
|
|
|
|
|
.arg("--runs=2")
|
2021-08-23 22:00:33 +02:00
|
|
|
.arg("echo dummy benchmark")
|
2021-08-23 21:48:31 +02:00
|
|
|
.assert()
|
|
|
|
|
.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
2021-11-11 14:10:58 +01:00
|
|
|
fn one_run_is_supported() {
|
2021-08-23 21:48:31 +02:00
|
|
|
hyperfine()
|
|
|
|
|
.arg("--runs=1")
|
2021-08-23 22:00:33 +02:00
|
|
|
.arg("echo dummy benchmark")
|
2021-08-23 21:48:31 +02:00
|
|
|
.assert()
|
2021-11-11 14:10:58 +01:00
|
|
|
.success();
|
2021-08-23 21:48:31 +02:00
|
|
|
}
|
2022-02-06 12:15:09 +01:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn fails_with_wrong_number_of_command_name_arguments() {
|
|
|
|
|
hyperfine()
|
|
|
|
|
.arg("--command-name=a")
|
|
|
|
|
.arg("--command-name=b")
|
|
|
|
|
.arg("echo a")
|
|
|
|
|
.assert()
|
|
|
|
|
.failure()
|
|
|
|
|
.stderr(predicate::str::contains("Too many --command-name options"));
|
|
|
|
|
}
|