mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 04:02:00 -07:00
18 lines
568 B
Rust
18 lines
568 B
Rust
use ignore::gitignore::GitignoreBuilder;
|
|
|
|
const IGNORE_FILE: &'static str = "tests/gitignore_skip_bom.gitignore";
|
|
|
|
/// Skip a Byte-Order Mark (BOM) at the beginning of the file, matching Git's
|
|
/// behavior.
|
|
///
|
|
/// Ref: <https://github.com/BurntSushi/ripgrep/issues/2177>
|
|
#[test]
|
|
fn gitignore_skip_bom() {
|
|
let mut builder = GitignoreBuilder::new("ROOT");
|
|
let error = builder.add(IGNORE_FILE);
|
|
assert!(error.is_none(), "failed to open gitignore file");
|
|
let g = builder.build().unwrap();
|
|
|
|
assert!(g.matched("ignore/this/path", false).is_ignore());
|
|
}
|