haskell-te: 9f312f63be557a0f8e0e3c24b779067cd1059713

     1: { annotated, cabal-install, fail, glibcLocales, haskellPackages, jq, lib,
     2:   runCommand, testData, unpack, withDeps }:
     3: 
     4: with builtins;
     5: with lib;
     6: with rec {
     7:   inherit (haskellPackages) reduce-equations;
     8: 
     9:   testSuite = runCommand "reduce-equations-test-suite"
    10:     {
    11:       inherit (reduce-equations) src;
    12:       LANG           = "en_US.UTF-8";
    13:       LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
    14:       buildInputs    = [
    15:         cabal-install
    16:         (haskellPackages.ghcWithPackages (h: [
    17:           h.bytestring
    18:           h.containers
    19:           h.directory
    20:           h.MissingH
    21:           h.tasty
    22:           h.tasty-quickcheck
    23:           h.reduce-equations
    24:         ]))
    25:         jq
    26:       ];
    27:     }
    28:     ''
    29:       set -e
    30:       export HOME="$PWD"
    31:       cabal update
    32:       cp -r "$src" ./src
    33:       chmod +w -R ./src
    34:       cd ./src
    35:       ./test.sh
    36:       mkdir "$out"
    37:     '';
    38: 
    39:   checkGetEqs = attr: eqs: runCommand "reduceProducesEqs-${attr}"
    40:     {
    41:       inherit eqs;
    42:       buildInputs = [ fail jq reduce-equations ];
    43:     }
    44:     ''
    45:       set -e
    46: 
    47:       function die {
    48:         echo "$GOT" 1>&2
    49:         fail "$*"
    50:       }
    51: 
    52:       GOT=$(reduce-equations < "$eqs")                 || die "Couldn't reduce"
    53:       echo "$GOT" | jq -e 'type == "array"'            || die 'Not array'
    54:       echo "$GOT" | jq -e 'map(has("relation")) | all' || die 'Not relation'
    55: 
    56:       mkdir "$out"
    57:     '';
    58: };
    59: 
    60: withDeps ([ testSuite ] ++ attrValues (mapAttrs checkGetEqs
    61:                                                 (testData.eqs {})))
    62:          reduce-equations

Generated by git2html.