Skip to content

Commit

Permalink
ripgrep: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
NeQuissimus committed Dec 23, 2020
1 parent d141829 commit 05bf935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ in
redis = handleTest ./redis.nix {};
redmine = handleTest ./redmine.nix {};
restic = handleTest ./restic.nix {};
ripgrep = handleTest ./ripgrep.nix {};
robustirc-bridge = handleTest ./robustirc-bridge.nix {};
roundcube = handleTest ./roundcube.nix {};
rspamd = handleTest ./rspamd.nix {};
Expand Down
13 changes: 13 additions & 0 deletions nixos/tests/ripgrep.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "ripgrep";
meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ nequissimus ]; };

nodes.ripgrep = { pkgs, ... }: { environment.systemPackages = [ pkgs.ripgrep ]; };

testScript = ''
ripgrep.succeed('echo "abc\nbcd\ncde" > /tmp/foo')
assert "bcd" in ripgrep.succeed("rg -N 'bcd' /tmp/foo")
assert "bcd\ncde" in ripgrep.succeed("rg -N 'cd' /tmp/foo")
assert "ripgrep ${pkgs.ripgrep.version}" in ripgrep.succeed("rg --version | head -1")
'';
})
3 changes: 3 additions & 0 deletions pkgs/tools/text/ripgrep/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ stdenv
, nixosTests
, fetchFromGitHub
, rustPlatform
, asciidoctor
Expand Down Expand Up @@ -34,6 +35,8 @@ rustPlatform.buildRustPackage rec {
installShellCompletion --zsh complete/_rg
'';

passthru.tests = { inherit (nixosTests) ripgrep; };

meta = with stdenv.lib; {
description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep";
homepage = "https://github.com/BurntSushi/ripgrep";
Expand Down

0 comments on commit 05bf935

Please sign in to comment.