1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-11-29 05:57:07 +02:00

grep-cli: support Brotli/Zstd decompression

Fixes #1099
This commit is contained in:
dana
2018-11-03 15:50:27 -05:00
committed by Andrew Gallant
parent 1ae121122f
commit 0b04553aff
5 changed files with 40 additions and 7 deletions

2
tests/data/sherlock.br Normal file
View File

@@ -0,0 +1,2 @@
n���-_�.� ����cM����Y�4�����Ya �-L�O(�8�sn^Gwш!,�
KD��/7��th�� ��]j�����E_;d�rF�Qs�/:DIVB}�T7��ѵ��H�2���)��M[u���i����50ڮ�Y6���������%�ר_��U by�4��Ϡ�!&�g��#�

BIN
tests/data/sherlock.zst Normal file

Binary file not shown.

View File

@@ -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;