mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-04 21:52:54 +02:00
tests: add test for filtering hidden files
Note that this isn't a regression test. In particular, this didn't fail with ripgrep 14.1.1. I couldn't figure out how to turn what the OP gave me into a failing test. With #829 fixed, if the OP can provide a better regression test, it might make sense to re-investigate this. Closes #2711
This commit is contained in:
@ -569,6 +569,64 @@ rgtest!(r807, |dir: Dir, mut cmd: TestCommand| {
|
|||||||
eqnice!(".a/c/file:test\n", cmd.arg("--hidden").arg("test").stdout());
|
eqnice!(".a/c/file:test\n", cmd.arg("--hidden").arg("test").stdout());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// See: https://github.com/BurntSushi/ripgrep/pull/2711
|
||||||
|
//
|
||||||
|
// Note that this isn't a regression test. In particular, this didn't fail
|
||||||
|
// with ripgrep 14.1.1. I couldn't figure out how to turn what the OP gave me
|
||||||
|
// into a failing test.
|
||||||
|
rgtest!(r2711, |dir: Dir, _cmd: TestCommand| {
|
||||||
|
dir.create_dir("a/b");
|
||||||
|
dir.create("a/.ignore", ".foo");
|
||||||
|
dir.create("a/b/.foo", "");
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
eqnice!("a/.ignore\n", cmd.arg("--hidden").arg("--files").stdout());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
eqnice!(
|
||||||
|
"./a/.ignore\n",
|
||||||
|
cmd.arg("--hidden").arg("--files").arg("./").stdout()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
eqnice!(
|
||||||
|
"a/.ignore\n",
|
||||||
|
cmd.arg("--hidden").arg("--files").arg("a").stdout()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
cmd.arg("--hidden").arg("--files").arg("a/b").assert_err();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
eqnice!(
|
||||||
|
"./a/.ignore\n",
|
||||||
|
cmd.arg("--hidden").arg("--files").arg("./a").stdout()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
cmd.current_dir(dir.path().join("a"));
|
||||||
|
eqnice!(".ignore\n", cmd.arg("--hidden").arg("--files").stdout());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
cmd.current_dir(dir.path().join("a").join("b"));
|
||||||
|
cmd.arg("--hidden").arg("--files").assert_err();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut cmd = dir.command();
|
||||||
|
cmd.current_dir(dir.path().join("./a"));
|
||||||
|
eqnice!(".ignore\n", cmd.arg("--hidden").arg("--files").stdout());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// See: https://github.com/BurntSushi/ripgrep/issues/829
|
// See: https://github.com/BurntSushi/ripgrep/issues/829
|
||||||
rgtest!(r829_original, |dir: Dir, _cmd: TestCommand| {
|
rgtest!(r829_original, |dir: Dir, _cmd: TestCommand| {
|
||||||
dir.create_dir("a/b");
|
dir.create_dir("a/b");
|
||||||
|
Reference in New Issue
Block a user