diff options
author | Wieland Hoffmann <themineo@gmail.com> | 2020-04-10 11:19:25 +0200 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2020-05-08 23:24:40 -0400 |
commit | df7a3bfc7fe30f3e9e89d8775748b1239c5b5fc4 (patch) | |
tree | a5ffa8a165feb657aebfc5bf8dde92f2be984fb3 /tests | |
parent | 28f2a93caefef8018c786c80c9b47f13f62c01c3 (diff) |
grep-cli: support files compressed by compress(1)
While Linux distributions (at least Arch Linux, RHEL, Debian) do not support
compressing files with compress(1), macOS & AIX do (the utility is part of
POSIX). Additionally, gzip is able to uncompress such compressed files and
provides an `uncompress` binary.
Closes #1547
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/sherlock.Z | bin | 0 -> 286 bytes | |||
-rw-r--r-- | tests/misc.rs | 15 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/data/sherlock.Z b/tests/data/sherlock.Z Binary files differnew file mode 100644 index 00000000..9ffa9283 --- /dev/null +++ b/tests/data/sherlock.Z diff --git a/tests/misc.rs b/tests/misc.rs index 16792a2b..9ec1107e 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -970,6 +970,21 @@ be, to a very large extent, the result of luck. Sherlock Holmes eqnice!(expected, cmd.stdout()); }); +rgtest!(compressed_uncompress, |dir: Dir, mut cmd: TestCommand| { + if !cmd_exists("uncompress") { + return; + } + + dir.create_bytes("sherlock.Z", include_bytes!("./data/sherlock.Z")); + cmd.arg("-z").arg("Sherlock").arg("sherlock.Z"); + + 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 +"; + eqnice!(expected, cmd.stdout()); +}); + rgtest!(compressed_failing_gzip, |dir: Dir, mut cmd: TestCommand| { if !cmd_exists("gzip") { return; |