summary refs log tree commit diff
path: root/pkgs/tools/text
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2021-10-29 14:42:32 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2021-10-31 21:25:12 -0300
commitdc4e3b543dd279674a767f222917dd64177f44b1 (patch)
tree70fd8af7998ebb5b69e445a947f11b7edce626a6 /pkgs/tools/text
parentf87e45d17e866f522a51b37dcb98f6415243a1aa (diff)
downloadnixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar.gz
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar.bz2
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar.lz
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar.xz
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.tar.zst
nixpkgs-dc4e3b543dd279674a767f222917dd64177f44b1.zip
ucg: rewrite tests
The tests can be easily done in the local machine, there is no necessity of
starting a virtual machine for them.
Diffstat (limited to 'pkgs/tools/text')
-rw-r--r--pkgs/tools/text/ucg/default.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/pkgs/tools/text/ucg/default.nix b/pkgs/tools/text/ucg/default.nix
index 26ad59fbb8e..d19379477d6 100644
--- a/pkgs/tools/text/ucg/default.nix
+++ b/pkgs/tools/text/ucg/default.nix
@@ -3,14 +3,11 @@
 , pkg-config
 , autoreconfHook
 , pcre
-, nixosTests
 }:
 
-let
+stdenv.mkDerivation rec {
   pname = "ucg";
-  version = "20190225";
-in stdenv.mkDerivation {
-  inherit pname version;
+  version = "0.3.3+date=2019-02-25";
 
   src = fetchFromGitHub {
     owner = "gvansickle";
@@ -19,8 +16,29 @@ in stdenv.mkDerivation {
     sha256 = "sha256-/wU1PmI4ejlv7gZzZNasgROYXFiDiIxE9BFoCo6+G5Y=";
   };
 
-  nativeBuildInputs = [ autoreconfHook pkg-config ];
-  buildInputs = [ pcre ];
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    pcre
+  ];
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    testFile=$(mktemp /tmp/ucg-test.XXXX)
+    echo -ne 'Lorem ipsum dolor sit amet\n2.7182818284590' > $testFile
+    $out/bin/ucg 'dolor' $testFile || { rm $testFile; exit -1; }
+    $out/bin/ucg --ignore-case 'lorem' $testFile || { rm $testFile; exit -1; }
+    $out/bin/ucg --word-regexp '2718' $testFile && { rm $testFile; exit -1; }
+    $out/bin/ucg 'pisum' $testFile && { rm $testFile; exit -1; }
+    rm $testFile
+
+    runHook postInstallCheck
+  '';
 
   meta = with lib; {
     homepage = "https://github.com/gvansickle/ucg/";
@@ -36,7 +54,5 @@ in stdenv.mkDerivation {
     platforms = with platforms; unix;
     broken = stdenv.isAarch64; # cpuid.h: no such file or directory
   };
-
-  passthru.tests = { inherit (nixosTests) ucg; };
 }
 # TODO: report upstream