bat: Add test

This commit is contained in:
Tim Steinbach 2020-11-28 13:33:16 -05:00
parent 2d85247086
commit fe8fa45573
No known key found for this signature in database
GPG key ID: FD36A5EAAC49035A
3 changed files with 16 additions and 0 deletions

View file

@ -30,6 +30,7 @@ in
avahi-with-resolved = handleTest ./avahi.nix { networkd = true; };
awscli = handleTest ./awscli.nix { };
babeld = handleTest ./babeld.nix {};
bat = handleTest ./bat.nix {};
bazarr = handleTest ./bazarr.nix {};
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
beanstalkd = handleTest ./beanstalkd.nix {};

12
nixos/tests/bat.nix Normal file
View file

@ -0,0 +1,12 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "bat";
meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ nequissimus ]; };
machine = { pkgs, ... }: { environment.systemPackages = [ pkgs.bat ]; };
testScript = ''
machine.succeed("echo 'Foobar\n\n\n42' > /tmp/foo")
assert "Foobar" in machine.succeed("bat -p /tmp/foo")
assert "42" in machine.succeed("bat -p /tmp/foo -r 4:4")
'';
})

View file

@ -1,4 +1,5 @@
{ stdenv
, nixosTests
, rustPlatform
, fetchFromGitHub
, pkg-config
@ -38,6 +39,8 @@ rustPlatform.buildRustPackage rec {
--prefix PATH : "${stdenv.lib.makeBinPath [ less ]}"
'';
passthru.tests = { inherit (nixosTests) bat; };
meta = with stdenv.lib; {
description = "A cat(1) clone with syntax highlighting and Git integration";
homepage = "https://github.com/sharkdp/bat";