mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-02 02:56:32 +02:00
0bc4f0447b
This is why I was so intent on clearing the PR queue. This will effectively invalidate all existing patches, so I wanted to start from a clean slate. We do make one little tweak: we put the default type definitions in their own file and tell rustfmt to keep its grubby mits off of it. We also sort it lexicographically and hopefully will enforce that from here on.
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) = crate::util::setup(stringify!($name));
|
|
$fun(dir, cmd);
|
|
|
|
if cfg!(feature = "pcre2") {
|
|
let (dir, cmd) = crate::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);
|
|
}
|
|
}
|
|
}
|