diff options
author | Robert Hensing <robert@roberthensing.nl> | 2024-01-28 14:09:27 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2024-01-28 14:09:27 +0100 |
commit | b78ba9bc68b003288d56bab62693ea28e2cdfd76 (patch) | |
tree | 39c14a9f4260f7c2cee7cb25816613a4eb58bc82 /lib/tests/modules.sh | |
parent | 0e756e65d5b1134e1364a731b583e233385ac7ae (diff) |
lib.types.unique: Check inner type deeply
This doesn't change uniq. Why not? - In NixOS it seems that uniq is only used with simple types that are fully checked by t.check. - It exists for much longer and is used more widely. - I believe we should deprecate it, because unique was already better. - unique can be a proving ground.
Diffstat (limited to 'lib/tests/modules.sh')
-rwxr-xr-x | lib/tests/modules.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index a90ff4ad9a2f6..1221ba7143f64 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -406,6 +406,16 @@ checkConfigOutput "{}" config.submodule.a ./emptyValues.nix checkConfigError 'The option .int.a. is used but not defined' config.int.a ./emptyValues.nix checkConfigError 'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a ./emptyValues.nix +# types.unique +# requires a single definition +checkConfigError 'The option .examples\.merged. is defined multiple times while it.s expected to be unique' config.examples.merged.a ./types-unique.nix +# user message is printed +checkConfigError 'We require a single definition, because seeing the whole value at once helps us maintain critical invariants of our system.' config.examples.merged.a ./types-unique.nix +# let the inner merge function check the values (on demand) +checkConfigError 'A definition for option .examples\.badLazyType\.a. is not of type .string.' config.examples.badLazyType.a ./types-unique.nix +# overriding still works (unlike option uniqueness) +checkConfigOutput '^"bee"$' config.examples.override.b ./types-unique.nix + ## types.raw checkConfigOutput '^true$' config.unprocessedNestingEvaluates.success ./raw.nix checkConfigOutput "10" config.processedToplevel ./raw.nix |