mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 13:23:53 +08:00
common: port err!() test helper
Unlike our C++ tests, our Rust tests fail as soon as an assertion fails. Whether this is desired is debatable; it seems fine for most cases and is easier to implement. This means that Rust tests usually don't need to print anything besides what assert!/assert_eq! already provide. One exception is the history merge test. Let's add a simple err!() macro to support this. Unlike the C++ err() it does not yet print colors. Currently all of our macros live in common.rs, to keep the import graph simple.
This commit is contained in:
parent
618834c4b5
commit
28a38946a5
|
@ -2108,6 +2108,14 @@ impl ToCString for &[u8] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test-only
|
||||||
|
#[allow(unused_macros)]
|
||||||
|
macro_rules! err {
|
||||||
|
($format:expr $(, $args:expr)* $(,)? ) => {
|
||||||
|
println!($format $(, $args )*);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unused_macros)]
|
#[allow(unused_macros)]
|
||||||
macro_rules! fwprintf {
|
macro_rules! fwprintf {
|
||||||
($fd:expr, $format:literal $(, $arg:expr)*) => {
|
($fd:expr, $format:literal $(, $arg:expr)*) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user