diff options
author | lassulus <lassulus@lassul.us> | 2018-12-02 00:56:16 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-12-04 16:40:32 +0100 |
commit | 995defbb9bd488a5d540f8420d3277644fed9aef (patch) | |
tree | a4645fc7f7fccaec475d96ea85579d3935c48062 /pkgs/build-support/writers/test.nix | |
parent | 90f0a7c390cc7b9f20025f8ca29f4e52fb899ee4 (diff) | |
download | nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar.gz nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar.bz2 nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar.lz nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar.xz nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.tar.zst nixlib-995defbb9bd488a5d540f8420d3277644fed9aef.zip |
build-support writers: content can be string or file
Diffstat (limited to 'pkgs/build-support/writers/test.nix')
-rw-r--r-- | pkgs/build-support/writers/test.nix | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pkgs/build-support/writers/test.nix b/pkgs/build-support/writers/test.nix index 68b7b27e6130..80e9543f9c85 100644 --- a/pkgs/build-support/writers/test.nix +++ b/pkgs/build-support/writers/test.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, runCommand, haskellPackages, nodePackages, perlPackages, python2Packages, python3Packages, writers}: +{ stdenv, lib, runCommand, haskellPackages, nodePackages, perlPackages, python2Packages, python3Packages, writers, writeText }: with writers; let @@ -128,6 +128,24 @@ let ''; }; + + path = { + bash = writeBash "test_bash" (writeText "test" '' + if [[ "test" == "test" ]]; then echo "success"; fi + ''); + haskell = writeHaskell "test_haskell" { libraries = [ haskellPackages.acme-default ]; } (writeText "test" '' + import Data.Default + + int :: Int + int = def + + main :: IO () + main = case int of + 18871 -> putStrLn $ id "success" + _ -> print "fail" + ''); + }; + writeTest = expectedValue: test: writeDash "test-writers" '' if test "$(${test})" != "${expectedValue}"; then @@ -142,6 +160,7 @@ in runCommand "test-writers" { } '' ${lib.concatMapStringsSep "\n" (test: writeTest "success" "${test}/bin/test_writers") (lib.attrValues bin)} ${lib.concatMapStringsSep "\n" (test: writeTest "success" "${test}") (lib.attrValues simple)} + ${lib.concatMapStringsSep "\n" (test: writeTest "success" "${test}") (lib.attrValues path)} echo 'nix-writers successfully tested' >&2 touch $out |