diff options
Diffstat (limited to 'pkgs/test/haskell/setBuildTarget/default.nix')
-rw-r--r-- | pkgs/test/haskell/setBuildTarget/default.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/test/haskell/setBuildTarget/default.nix b/pkgs/test/haskell/setBuildTarget/default.nix new file mode 100644 index 00000000000..161cecd9ec3 --- /dev/null +++ b/pkgs/test/haskell/setBuildTarget/default.nix @@ -0,0 +1,26 @@ +{ pkgs, haskellPackages }: with pkgs.haskell.lib; + + +let + drv = haskellPackages.callCabal2nix "haskell-setBuildTarget" ./. {}; + test = target: excluded: + + let only = setBuildTarget drv target; + in '' + if [[ ! -f "${only}/bin/${target}" ]]; then + echo "${target} was not built" + exit 1 + fi + + if [[ -f "${only}/bin/${excluded}" ]]; then + echo "${excluded} was built, when it should not have been" + exit 1 + fi + ''; + +in pkgs.runCommand "test haskell.lib.setBuildTarget" {} '' + ${test "foo" "bar"} + ${test "bar" "foo"} + touch "$out" +'' + |