macro_rules! assert_builds {
($($label:literal: $built:expr => $expected:expr;)*) => {
$(assert_eq!($built, $expected, $label);)*
};
}
macro_rules! assert_vec_setters {
($start:expr, $field:ident, $single:ident, $whole:ident, $ty:ty, $prefix:expr, $items:expr) => {{
let items: Vec<$ty> = Vec::<&str>::from($items)
.into_iter()
.map(<$ty>::from)
.collect();
let mut appended: Vec<$ty> = Vec::<&str>::from($prefix)
.into_iter()
.map(<$ty>::from)
.collect();
appended.extend(items[..2].iter().cloned());
assert_eq!(
$start
.$single(items[0].clone())
.$single(items[1].clone())
.build()
.$field,
appended,
concat!(stringify!($single), " appends")
);
assert_eq!(
$start
.$single(items[0].clone())
.$whole(items[1..].to_vec())
.build()
.$field,
items[1..],
concat!(stringify!($whole), " replaces")
);
}};
}
macro_rules! assert_not_debug {
($builder:expr) => {{
trait NotDebug {
fn is_debug(&self) -> bool {
false
}
}
struct Probe<T>(T);
impl<T> NotDebug for Probe<T> {}
#[allow(
dead_code,
reason = "it exists to win method resolution when `T` is `Debug`"
)]
impl<T: std::fmt::Debug> Probe<T> {
fn is_debug(&self) -> bool {
true
}
}
assert!(!Probe($builder).is_debug(), "the builder must not be Debug");
}};
}
mod fetch;
mod options;
mod plugin;
mod registry;
mod release;
mod render;
mod repo;
mod search_show;