feat(nix/yants/tests): test drv type

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>
This commit is contained in:
sterni 2021-02-09 23:30:42 +01:00
parent 3a45e029af
commit 7bd43d15d9

View file

@ -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" [