2018-08-07 02:11:58 +02:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! rgtest {
|
|
|
|
($name:ident, $fun:expr) => {
|
|
|
|
#[test]
|
|
|
|
fn $name() {
|
2019-01-19 17:15:56 +02:00
|
|
|
let (dir, cmd) = crate::util::setup(stringify!($name));
|
2018-08-07 02:11:58 +02:00
|
|
|
$fun(dir, cmd);
|
|
|
|
|
|
|
|
if cfg!(feature = "pcre2") {
|
2019-01-19 17:15:56 +02:00
|
|
|
let (dir, cmd) = crate::util::setup_pcre2(stringify!($name));
|
2018-08-07 02:11:58 +02:00
|
|
|
$fun(dir, cmd);
|
|
|
|
}
|
|
|
|
}
|
2020-02-18 01:08:47 +02:00
|
|
|
};
|
2018-08-07 02:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! eqnice {
|
|
|
|
($expected:expr, $got:expr) => {
|
|
|
|
let expected = &*$expected;
|
|
|
|
let got = &*$got;
|
|
|
|
if expected != got {
|
|
|
|
panic!("
|
|
|
|
printed outputs differ!
|
|
|
|
|
|
|
|
expected:
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
{}
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
got:
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
{}
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
", expected, got);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! eqnice_repr {
|
|
|
|
($expected:expr, $got:expr) => {
|
|
|
|
let expected = &*$expected;
|
|
|
|
let got = &*$got;
|
|
|
|
if expected != got {
|
|
|
|
panic!("
|
|
|
|
printed outputs differ!
|
|
|
|
|
|
|
|
expected:
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
{:?}
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
got:
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
{:?}
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
", expected, got);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|