diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-11-30 22:38:56 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-12-17 21:52:24 +0100 |
commit | 767d80099cd8418b3cc7338eb24f9217fedb6449 (patch) | |
tree | dc6af45088e2c6f2e5fefa63034f7077f350ad6f /lib/tests/modules.sh | |
parent | 991dfccbd1935aabb76a20245ca0108aadd38f3c (diff) | |
download | nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar.gz nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar.bz2 nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar.lz nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar.xz nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.tar.zst nixpkgs-767d80099cd8418b3cc7338eb24f9217fedb6449.zip |
lib/modules: Introduce _module.checks.*.check
Previously the .enable option was used to encode the condition as well, which lead to some oddness: - In order to encode an assertion, one had to invert it - To disable a check, one had to mkForce it By introducing a separate .check option this is solved because: - It can be used to encode assertions - Disabling is done separately with .enable option, whose default can be overridden without a mkForce
Diffstat (limited to 'lib/tests/modules.sh')
-rwxr-xr-x | lib/tests/modules.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 9e85c90d15c..775be9f7209 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -279,7 +279,8 @@ checkConfigOutput baz config.value.nested.bar.baz ./types-anything/mk-mods.nix # Check that assertions are triggered by default for just evaluating config checkConfigError 'Failed checks:\n- \[test\] Assertion failed' config ./assertions/simple.nix -# Assertion is not triggered when enable is false +# Assertion is not triggered when enable is false or condition is true +checkConfigOutput '{ }' config ./assertions/condition-true.nix checkConfigOutput '{ }' config ./assertions/enable-false.nix # Warnings should be displayed on standard error |