tests: cleanup test_util module
We can remove the `tests` module as the entire file is only
available when running tests.
Follow-up of #7130 / 1f13165fae.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
9d8bda20e5
commit
53e9c94e68
3 changed files with 17 additions and 17 deletions
|
|
@ -1142,7 +1142,7 @@ mod tests {
|
|||
use std::cmp::Ordering;
|
||||
|
||||
use super::*;
|
||||
use crate::test_util::tests::assert_args_sorted;
|
||||
use crate::test_util::assert_args_sorted;
|
||||
|
||||
#[test]
|
||||
fn test_cli_args_sorted() {
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ mod unit_tests {
|
|||
PayloadConfig, RngConfig, VmConfig,
|
||||
};
|
||||
|
||||
use crate::test_util::tests::assert_args_sorted;
|
||||
use crate::test_util::assert_args_sorted;
|
||||
use crate::{create_app, get_cli_options_sorted, prepare_default_values};
|
||||
|
||||
fn get_vm_config_from_vec(args: &[&str]) -> VmConfig {
|
||||
|
|
|
|||
|
|
@ -3,22 +3,22 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use std::cmp::Ordering;
|
||||
//! Test utilities.
|
||||
|
||||
use clap::Arg;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
pub fn assert_args_sorted<'a, F: Fn() -> R, R: Iterator<Item = &'a Arg>>(get_base_iter: F) {
|
||||
let iter = get_base_iter().zip(get_base_iter().skip(1));
|
||||
for (arg, next) in iter {
|
||||
assert_ne!(
|
||||
arg.get_id().cmp(next.get_id()),
|
||||
Ordering::Greater,
|
||||
"args not alphabetically sorted: arg={}, next={}",
|
||||
arg.get_id(),
|
||||
next.get_id()
|
||||
);
|
||||
}
|
||||
use clap::Arg;
|
||||
|
||||
/// Ensures that all [`Arg`]s are sorted alphabetically.
|
||||
pub fn assert_args_sorted<'a, F: Fn() -> R, R: Iterator<Item = &'a Arg>>(get_base_iter: F) {
|
||||
let iter = get_base_iter().zip(get_base_iter().skip(1));
|
||||
for (arg, next) in iter {
|
||||
assert_ne!(
|
||||
arg.get_id().cmp(next.get_id()),
|
||||
Ordering::Greater,
|
||||
"args not alphabetically sorted: arg={}, next={}",
|
||||
arg.get_id(),
|
||||
next.get_id()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue