From dc02296243cef1524281818b903b6a1b47110c7c Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 3 Feb 2025 09:49:02 +0100 Subject: [PATCH] buildClan: add more eager tests --- lib/build-clan/tests.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/build-clan/tests.nix b/lib/build-clan/tests.nix index 6f0a6b302..d9cd755c6 100644 --- a/lib/build-clan/tests.nix +++ b/lib/build-clan/tests.nix @@ -10,9 +10,30 @@ let inherit lib nixpkgs clan-core; self = ./.; }; + + # Shallowly force all attribute values to be evaluated. + shallowForceAllAttributes = lib.foldlAttrs ( + _acc: _name: value: + lib.seq value true + ) true; in ####### { + test_missing_self = + let + config = buildClan { + meta.name = "test"; + imports = [ ./module.nix ]; + }; + in + { + expr = shallowForceAllAttributes config; + expectedError = { + type = "ThrownError"; + msg = "A definition for option `directory' is not of type `path*"; + }; + }; + test_only_required = let config = evalClan { @@ -25,7 +46,7 @@ in }; in { - expr = config.inventory ? meta; + expr = shallowForceAllAttributes config; expected = true; };