about summary refs log tree commit diff
path: root/nix/yants/tests/default.nix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-02-09T22·30+0100
committersterni <sternenseemann@systemli.org>2021-02-12T21·52+0000
commit7bd43d15d90f05d752578ca14abc064e5f3db7af (patch)
treed18cbe58fa2546d171e96339c11cbb3c088390f4 /nix/yants/tests/default.nix
parent3a45e029af57fffcda75a5be77159345a66da412 (diff)
feat(nix/yants/tests): test drv type r/2202
By using an extremely trivial derivation we can ensure that it will not
throw if evaluated using deepSeq. When using stdenv.mkDerivation or
similar at some point something will most likely throw or generate some
kind of error which is alright in the context of nixpkgs, but makes
testing yants harder than you'd think it should be.

Change-Id: I61ff7dc01a00a4815ef39066e4e223123356ddd5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2507
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix/yants/tests/default.nix')
-rw-r--r--nix/yants/tests/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nix/yants/tests/default.nix b/nix/yants/tests/default.nix
index 9062bc64557a..9a0b2403e124 100644
--- a/nix/yants/tests/default.nix
+++ b/nix/yants/tests/default.nix
@@ -15,6 +15,15 @@ let
     assertDoesNotThrow
     ;
 
+  # this derivation won't throw if evaluated with deepSeq
+  # unlike most things even remotely related with nixpkgs
+  trivialDerivation = derivation {
+    name = "trivial-derivation";
+    inherit (pkgs.stdenv) system;
+    builder = "/bin/sh";
+    args = [ "-c" "echo hello > $out" ];
+  };
+
   testPrimitives = it "checks that all primitive types match" [
     (assertDoesNotThrow "unit type" (unit {}))
     (assertDoesNotThrow "int type" (int 15))
@@ -23,6 +32,7 @@ let
     (assertDoesNotThrow "string type" (string "Hello!"))
     (assertDoesNotThrow "function type" (function (x: x * 2)))
     (assertDoesNotThrow "path type" (path /nix))
+    (assertDoesNotThrow "derivation type" (drv trivialDerivation))
   ];
 
   testPoly = it "checks that polymorphic types work as intended" [