diff options
author | Rebecca Turner <rbt@sent.as> | 2023-12-18 12:04:36 -0800 |
---|---|---|
committer | Rebecca Turner <rbt@sent.as> | 2023-12-19 09:23:09 -0800 |
commit | fa9727cf1e4916d948529946b877eae7f0a61b0d (patch) | |
tree | 20ab52d47d1f7bea1a489236d3f2228f8b8cc33a /lib/tests/modules | |
parent | 5a9be42754cee0d35d893cbed08737486e5f5e6d (diff) | |
download | nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar.gz nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar.bz2 nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar.lz nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar.xz nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.tar.zst nixlib-fa9727cf1e4916d948529946b877eae7f0a61b0d.zip |
lib: `modules.sh` should check JSON output for predictability
Currently, the `lib/tests/modules.sh` test checks the output of `nix-instantiate --eval` without `--json`, which outputs an unspecified human-readable format. This patch modifies `modules.sh` to use the `--json` output instead, to be robust against future changes to `nix-instantiate` output.
Diffstat (limited to 'lib/tests/modules')
-rw-r--r-- | lib/tests/modules/raw.nix | 5 | ||||
-rw-r--r-- | lib/tests/modules/types-anything/equal-atoms.nix | 4 | ||||
-rw-r--r-- | lib/tests/modules/types-anything/functions.nix | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/tests/modules/raw.nix b/lib/tests/modules/raw.nix index 418e671ed076..9eb7c5ce8f21 100644 --- a/lib/tests/modules/raw.nix +++ b/lib/tests/modules/raw.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{ lib, config, ... }: { options = { processedToplevel = lib.mkOption { @@ -13,6 +13,9 @@ priorities = lib.mkOption { type = lib.types.raw; }; + unprocessedNestingEvaluates = lib.mkOption { + default = builtins.tryEval config.unprocessedNesting; + }; }; config = { diff --git a/lib/tests/modules/types-anything/equal-atoms.nix b/lib/tests/modules/types-anything/equal-atoms.nix index 972711201a09..9925cfd60892 100644 --- a/lib/tests/modules/types-anything/equal-atoms.nix +++ b/lib/tests/modules/types-anything/equal-atoms.nix @@ -9,7 +9,7 @@ value.int = 0; value.bool = false; value.string = ""; - value.path = /.; + value.path = ./.; value.null = null; value.float = 0.1; } @@ -17,7 +17,7 @@ value.int = 0; value.bool = false; value.string = ""; - value.path = /.; + value.path = ./.; value.null = null; value.float = 0.1; } diff --git a/lib/tests/modules/types-anything/functions.nix b/lib/tests/modules/types-anything/functions.nix index 21edd4aff9c4..3288b64f9b7e 100644 --- a/lib/tests/modules/types-anything/functions.nix +++ b/lib/tests/modules/types-anything/functions.nix @@ -1,5 +1,9 @@ { lib, config, ... }: { + options.valueIsFunction = lib.mkOption { + default = lib.mapAttrs (name: lib.isFunction) config.value; + }; + options.value = lib.mkOption { type = lib.types.anything; }; |