From 7bd43d15d90f05d752578ca14abc064e5f3db7af Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 9 Feb 2021 23:30:42 +0100 Subject: [PATCH] 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 --- nix/yants/tests/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/yants/tests/default.nix b/nix/yants/tests/default.nix index 9062bc645..9a0b2403e 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" [