Merge pull request #124 from Linus789/fix_tests

Fix tests
This commit is contained in:
Gregory 2021-05-05 22:27:35 -04:00 committed by GitHub
commit 9ab3372026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -78,7 +78,6 @@ impl App {
let file =
unsafe { memmap::Mmap::map(&File::open(path)?)? };
if self.replacer.has_matches(&file) {
println!("{}", path.display());
handle
.write_all(&self.replacer.replace_preview(&file))?;
}

View file

@ -46,11 +46,14 @@ mod cli {
let mut file = tempfile::NamedTempFile::new()?;
file.write(b"abc123def")?;
#[rustfmt::skip]
sd().args(&["-p", "abc\\d+", "", file.path().to_str().unwrap()])
.assert()
.success()
.stdout("def");
sd().args(&["-p", "abc\\d+", "", file.path().to_str().unwrap()])
.assert()
.success()
.stdout(format!(
"{}{}def",
ansi_term::Color::Green.prefix().to_string(),
ansi_term::Color::Green.suffix().to_string()
));
assert_file(file.path(), "abc123def");