Skip to content

Commit

Permalink
Merge pull request chmln#124 from Linus789/fix_tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
chmln authored May 6, 2021
2 parents bc0a450 + 2b3b201 commit 9ab3372
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?;
}
Expand Down
13 changes: 8 additions & 5 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 9ab3372

Please sign in to comment.