diff options
author | Charles Blake <cb@cblake.net> | 2018-07-13 09:54:51 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2018-07-21 17:25:12 -0400 |
commit | 231456c409ff38c75c39d01b781b569965ddf808 (patch) | |
tree | 592b89acd3172b0c23acdfe6113bcd70ea11aa3a /tests | |
parent | 1d09d4d31ba3ac2eb09edf31e8ec46b2b5cec388 (diff) |
ripgrep: add --pre flag
The preprocessor flag accepts a command program and executes this
program for every input file that is searched. Instead of searching the
file directly, ripgrep will instead search the stdout contents of the
program.
Closes #978, Closes #981
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 9920c118..6a5bf73f 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1733,6 +1733,26 @@ sherlock!(feature_419_zero_as_shortcut_for_null, "Sherlock", ".", }); #[test] +fn preprocessing() { + if !cmd_exists("xzcat") { + return; + } + let xz_file = include_bytes!("./data/sherlock.xz"); + + let wd = WorkDir::new("feature_preprocessing"); + wd.create_bytes("sherlock.xz", xz_file); + + let mut cmd = wd.command(); + cmd.arg("--pre").arg("xzcat").arg("Sherlock").arg("sherlock.xz"); + let lines: String = wd.stdout(&mut cmd); + let expected = "\ +For the Doctor Watsons of this world, as opposed to the Sherlock +be, to a very large extent, the result of luck. Sherlock Holmes +"; + assert_eq!(lines, expected); +} + +#[test] fn compressed_gzip() { if !cmd_exists("gzip") { return; |