summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-11-03 15:50:27 -0500
committerAndrew Gallant <jamslam@gmail.com>2019-01-22 20:56:16 -0500
commit0b04553affdb4e15ffd4ef2a29840cad3fc4fc7a (patch)
tree4c049fa07fdfe2de1c1d321b060a8063954ec911 /tests
parent1ae121122f670e95dc6b5a006c5d2a25cbc7eaa2 (diff)
grep-cli: support Brotli/Zstd decompression
Fixes #1099
Diffstat (limited to 'tests')
-rw-r--r--tests/data/sherlock.br2
-rw-r--r--tests/data/sherlock.zstbin0 -> 249 bytes
-rw-r--r--tests/misc.rs30
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/data/sherlock.br b/tests/data/sherlock.br
new file mode 100644
index 00000000..7d0a9613
--- /dev/null
+++ b/tests/data/sherlock.br
@@ -0,0 +1,2 @@
+n-_. cMY4Ya -LO(8sn^Gwш!,
+KD/7th ]jE_;drFQs/:DIVB}T7ѵH2)M[ui50ڮY6%ר_U by4Ϡ!&g# \ No newline at end of file
diff --git a/tests/data/sherlock.zst b/tests/data/sherlock.zst
new file mode 100644
index 00000000..c649ac9b
--- /dev/null
+++ b/tests/data/sherlock.zst
Binary files differ
diff --git a/tests/misc.rs b/tests/misc.rs
index 31662871..b4e620c5 100644
--- a/tests/misc.rs
+++ b/tests/misc.rs
@@ -909,6 +909,36 @@ be, to a very large extent, the result of luck. Sherlock Holmes
eqnice!(expected, cmd.stdout());
});
+rgtest!(compressed_brotli, |dir: Dir, mut cmd: TestCommand| {
+ if !cmd_exists("brotli") {
+ return;
+ }
+
+ dir.create_bytes("sherlock.br", include_bytes!("./data/sherlock.br"));
+ cmd.arg("-z").arg("Sherlock").arg("sherlock.br");
+
+ 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_zstd, |dir: Dir, mut cmd: TestCommand| {
+ if !cmd_exists("zstd") {
+ return;
+ }
+
+ dir.create_bytes("sherlock.zst", include_bytes!("./data/sherlock.zst"));
+ cmd.arg("-z").arg("Sherlock").arg("sherlock.zst");
+
+ 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;