output-template: run the tests
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
check:
|
||||
./output-template '{{' '}}' < example.ini > output
|
||||
diff -u output example.ini.expected
|
@@ -2,6 +2,7 @@
|
||||
fetchurl,
|
||||
writeFennel,
|
||||
fennel,
|
||||
fennelrepl,
|
||||
runCommand,
|
||||
lua,
|
||||
anoia,
|
||||
@@ -17,9 +18,9 @@ stdenv.mkDerivation {
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ lua ];
|
||||
doCheck = true;
|
||||
|
||||
nativeBuildInputs = [ fennelrepl ] ;
|
||||
buildPhase = ''
|
||||
fennelrepl --test ./output-template.fnl
|
||||
cp -p ${
|
||||
writeFennel name {
|
||||
packages = [
|
||||
@@ -27,11 +28,11 @@ stdenv.mkDerivation {
|
||||
lualinux
|
||||
linotify
|
||||
];
|
||||
macros = [ anoia.dev ];
|
||||
mainFunction = "run";
|
||||
} ./output-template.fnl
|
||||
} ${name}
|
||||
'';
|
||||
checkPhase = "make check";
|
||||
installPhase = ''
|
||||
install -D ${name} $out/bin/${name}
|
||||
'';
|
||||
|
@@ -41,4 +41,12 @@
|
||||
out (substitute (: (io.input) :read "*a") opening closing)]
|
||||
(io.write out)))
|
||||
|
||||
(import-macros { : define-tests : expect : expect= } :anoia.assert)
|
||||
(define-tests
|
||||
(fn slurp [name]
|
||||
(with-open [f (assert (io.open name))] (f:read "*a")))
|
||||
(expect=
|
||||
(pick-values 1 (substitute (slurp "example.ini") "{{" "}}"))
|
||||
(slurp "example.ini.expected")))
|
||||
|
||||
{ : run }
|
||||
|
Reference in New Issue
Block a user