git.iko.soy/typeable/nixpkgs
on master help sign in
ripgrep: Add test
commit05bf935bc6dbffaec6fe11ddb29390e495393927 authorTim Steinbach <tim@nequissimus.com> dateWed 23 Dec 2020, 12:30 (6 years ago) parentd141829
3 files changed+17
nixos/tests/all-tests.nix+1 nixos/tests/ripgrep.nix+13 pkgs/tools/text/ripgrep/default.nix+3
nixos/tests/all-tests.nix+1
@@ -324,6 +324,7 @@ in
324324 redis = handleTest ./redis.nix {};
325325 redmine = handleTest ./redmine.nix {};
326326 restic = handleTest ./restic.nix {};
327+ ripgrep = handleTest ./ripgrep.nix {};
327328 robustirc-bridge = handleTest ./robustirc-bridge.nix {};
328329 roundcube = handleTest ./roundcube.nix {};
329330 rspamd = handleTest ./rspamd.nix {};
nixos/tests/ripgrep.nixnew file+13
@@ -0,0 +1,13 @@
1+import ./make-test-python.nix ({ pkgs, ... }: {
2+ name = "ripgrep";
3+ meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ nequissimus ]; };
4+
5+ nodes.ripgrep = { pkgs, ... }: { environment.systemPackages = [ pkgs.ripgrep ]; };
6+
7+ testScript = ''
8+ ripgrep.succeed('echo "abc\nbcd\ncde" > /tmp/foo')
9+ assert "bcd" in ripgrep.succeed("rg -N 'bcd' /tmp/foo")
10+ assert "bcd\ncde" in ripgrep.succeed("rg -N 'cd' /tmp/foo")
11+ assert "ripgrep ${pkgs.ripgrep.version}" in ripgrep.succeed("rg --version | head -1")
12+ '';
13+})
pkgs/tools/text/ripgrep/default.nix+3
@@ -1,4 +1,5 @@
11{ stdenv
2+, nixosTests
23, fetchFromGitHub
34, rustPlatform
45, asciidoctor
@@ -34,6 +35,8 @@ rustPlatform.buildRustPackage rec {
3435 installShellCompletion --zsh complete/_rg
3536 '';
3637
38+ passthru.tests = { inherit (nixosTests) ripgrep; };
39+
3740 meta = with stdenv.lib; {
3841 description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep";
3942 homepage = "https://github.com/BurntSushi/ripgrep";