mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-12 19:18:24 +02:00
62 lines
1.5 KiB
Rust
62 lines
1.5 KiB
Rust
|
#[macro_export]
|
||
|
macro_rules! rgtest {
|
||
|
($name:ident, $fun:expr) => {
|
||
|
#[test]
|
||
|
fn $name() {
|
||
|
let (dir, cmd) = ::util::setup(stringify!($name));
|
||
|
$fun(dir, cmd);
|
||
|
|
||
|
if cfg!(feature = "pcre2") {
|
||
|
let (dir, cmd) = ::util::setup_pcre2(stringify!($name));
|
||
|
$fun(dir, cmd);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[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);
|
||
|
}
|
||
|
}
|
||
|
}
|