sgrep: add smoke test

This commit is contained in:
Sebastian Reuße 2022-07-09 18:50:01 +02:00
parent 8d9ea37e80
commit 37681056c2

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, lib, m4, makeWrapper }:
{ stdenv, sgrep, fetchurl, runCommand, lib, m4, makeWrapper }:
stdenv.mkDerivation rec {
pname = "sgrep";
@ -16,6 +16,14 @@ stdenv.mkDerivation rec {
--prefix PATH : ${lib.makeBinPath [ m4 ]}
'';
passthru.tests.smokeTest = runCommand "test-sgrep" { } ''
expr='"<foo>" __ "</foo>"'
data="<foo>1</foo><bar>2</bar>"
${sgrep}/bin/sgrep "$expr" <<<$data >$out
read result <$out
[[ $result = 1 ]]
'';
meta = with lib; {
homepage = "https://www.cs.helsinki.fi/u/jjaakkol/sgrep.html";
description = "A grep for structured text formats such as XML";