forked from mirrors/nixpkgs
tinyscheme: add some tests
This commit is contained in:
parent
8f0ec82696
commit
4c958b1200
|
@ -1,4 +1,10 @@
|
|||
{ lib, stdenv, fetchurl, dos2unix }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, dos2unix
|
||||
, runCommand
|
||||
, tinyscheme
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "tinyscheme";
|
||||
|
@ -38,6 +44,28 @@ stdenv.mkDerivation rec {
|
|||
cp scheme $out/bin/tinyscheme
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
# Checks that the program can run and exit:
|
||||
simple = runCommand "${pname}-simple-test" {} ''
|
||||
${tinyscheme}/bin/tinyscheme <<<"(quit 0)"
|
||||
echo "success" > $out
|
||||
'';
|
||||
fileIo = runCommand "${pname}-file-io-test" {} ''
|
||||
${tinyscheme}/bin/tinyscheme <<EOF
|
||||
(call-with-output-file "$out"
|
||||
(lambda (p)
|
||||
(begin
|
||||
(write "success!" p)
|
||||
(newline p)
|
||||
)))
|
||||
EOF
|
||||
'';
|
||||
helpText = runCommand "${pname}-help-text-test" {} ''
|
||||
${tinyscheme}/bin/tinyscheme '-?' | tee > $out || :
|
||||
[[ "$(cat $out)" =~ ^Usage: ]]
|
||||
'';
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Lightweight Scheme implementation";
|
||||
longDescription = ''
|
||||
|
|
Loading…
Reference in a new issue