mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Fix prepare and conclude behaviour and add tests.
This commit is contained in:
1 parent
9806ed7694
commit
d4749b015f
4 files changed
+306
-6
No files matched your search
+10
-6
@@ -437,21 +437,25 @@ impl Options {
|
||||
}
|
||||
|
||||
pub fn validate_against_command_list(&self, commands: &Commands) -> Result<()> {
|
||||
let num_commands = commands.num_commands()
|
||||
+ if self.reference_command.is_some() {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
if let Some(preparation_command) = &self.preparation_command {
|
||||
ensure!(
|
||||
preparation_command.len() <= 1
|
||||
|| commands.num_commands() == preparation_command.len(),
|
||||
preparation_command.len() <= 1 || num_commands == preparation_command.len(),
|
||||
"The '--prepare' option has to be provided just once or N times, where N is the \
|
||||
number of benchmark commands."
|
||||
number of benchmark commands including a potential reference."
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(conclusion_command) = &self.conclusion_command {
|
||||
ensure!(
|
||||
conclusion_command.len() <= 1
|
||||
|| commands.num_commands() == conclusion_command.len(),
|
||||
conclusion_command.len() <= 1 || num_commands == conclusion_command.len(),
|
||||
"The '--conclude' option has to be provided just once or N times, where N is the \
|
||||
number of benchmark commands."
|
||||
number of benchmark commands including a potential reference."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user