From 415d1932eae07d9a64e1e21199a2b9c904ce3d5f Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 25 Nov 2024 16:06:23 +0100 Subject: [PATCH] lib/types: Test attrsWith type merging Co-Authored-By: @hsjobeki --- lib/tests/modules.sh | 6 ++-- lib/tests/modules/lazy-attrsWith.nix | 46 ++++++++++++++++++---------- lib/types.nix | 3 +- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 2443c080180bd..4c00ecaab605b 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -386,6 +386,10 @@ checkConfigOutput '^true$' config.conditionalWorks ./declare-attrsOf.nix ./attrs checkConfigOutput '^false$' config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix checkConfigOutput '^"empty"$' config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix +# Check attrsWith type merging +checkConfigError 'The option `mergedLazyNonLazy'\'' in `.*'\'' is already declared in `.*'\''\.' options.mergedLazyNonLazy ./lazy-attrsWith.nix +checkConfigOutput '^11$' config.lazyResult ./lazy-attrsWith.nix +checkConfigError 'infinite recursion encountered' config.nonLazyResult ./lazy-attrsWith.nix # Even with multiple assignments, a type error should be thrown if any of them aren't valid checkConfigError 'A definition for option .* is not of type .*' \ @@ -575,8 +579,6 @@ checkConfigOutput '^38|27$' options.submoduleLine38.declarationPositions.1.line # nested options work checkConfigOutput '^34$' options.nested.nestedLine34.declarationPositions.0.line ./declaration-positions.nix -# AttrsWith tests -checkConfigOutput '^11$' config.result ./lazy-attrsWith.nix cat <