Merge pull request #143768 from iAmMrinal0/remove/batTest

bat: move nixos test to installCheckPhase
This commit is contained in:
Maximilian Bosch 2021-10-30 12:55:29 +02:00 committed by GitHub
commit bd2411b1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 15 deletions

View File

@ -34,7 +34,6 @@ 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 {};

View File

@ -1,12 +0,0 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "bat";
meta = with pkgs.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,6 +1,5 @@
{ lib
, stdenv
, nixosTests
, rustPlatform
, fetchFromGitHub
, pkg-config
@ -41,7 +40,18 @@ rustPlatform.buildRustPackage rec {
checkFlags = [ "--skip=pager_more" "--skip=pager_most" ];
passthru.tests = { inherit (nixosTests) bat; };
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
testFile=$(mktemp /tmp/bat-test.XXXX)
echo -ne 'Foobar\n\n\n42' > $testFile
$out/bin/bat -p $testFile | grep "Foobar"
$out/bin/bat -p $testFile -r 4:4 | grep 42
rm $testFile
runHook postInstallCheck
'';
meta = with lib; {
description = "A cat(1) clone with syntax highlighting and Git integration";