From b333395be54397a62e6befe2bc91664f53306b41 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 15 Oct 2021 16:48:38 +0200 Subject: [PATCH] lib/tests: Add tests for emptyValue --- lib/tests/modules.sh | 9 ++++++++ lib/tests/modules/emptyValues.nix | 36 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 lib/tests/modules/emptyValues.nix diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 590937da5b8f..88d152d39352 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -284,6 +284,15 @@ checkConfigOutput '^"a b"$' config.resultFoo ./declare-variants.nix ./define-var checkConfigOutput '^"a y z"$' config.resultFooBar ./declare-variants.nix ./define-variant.nix checkConfigOutput '^"a b c"$' config.resultFooFoo ./declare-variants.nix ./define-variant.nix +## emptyValue's +checkConfigOutput "[ ]" config.list.a ./emptyValues.nix +checkConfigOutput "{ }" config.attrs.a ./emptyValues.nix +checkConfigOutput "null" config.null.a ./emptyValues.nix +checkConfigOutput "{ }" config.submodule.a ./emptyValues.nix +# These types don't have empty values +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 + cat <