mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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
25 lines
624 B
Rust
25 lines
624 B
Rust
// Copyright © 2025 Cyberus Technology GmbH
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
//! Test utilities.
|
|
|
|
use std::cmp::Ordering;
|
|
|
|
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()
|
|
);
|
|
}
|
|
}
|