From 3c4a49f506575306f8b355e86d2b19cf02c84688 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 14 Jun 2022 23:12:46 +0200 Subject: lib/modules: Throw earlier when module function does not return attrs `m` must always be an attrset at this point. It is basically always evaluated. This will make it throw when any of the attrs is accessed, rather than just `config`. We assume that this will improve the error message in more scenarios. --- lib/tests/modules.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/tests/modules.sh') diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 29f6272ea50a..c92cc62023b5 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -199,6 +199,7 @@ checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path. checkConfigOutput '"beta"' config.nodes.foo.settingsDict.c ./deferred-module.nix # errors from the default module are reported with accurate location checkConfigError 'In `the-file-that-contains-the-bad-config.nix, via option default'\'': "bogus"' config.nodes.foo.bottom ./deferred-module.nix +checkConfigError '.*lib/tests/modules/deferred-module-error.nix, via option deferred [(]:anon-1:anon-1:anon-1[)] does not look like a module.' config.result ./deferred-module-error.nix # Check the file location information is propagated into submodules checkConfigOutput the-file.nix config.submodule.internalFiles.0 ./submoduleFiles.nix -- cgit 1.4.1