summary refs log tree commit diff
path: root/lib/tests/modules.sh
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-12-02 10:49:10 +0000
committerRobert Hensing <robert@roberthensing.nl>2022-12-02 11:06:53 +0000
commit6110a6009fc77348e9c47e0801a9b884dc76c730 (patch)
tree40963b832551c478c0cb2c24d6364173cdd67dd2 /lib/tests/modules.sh
parente76c78d20685a043d23f5f9e0ccd2203997f1fb1 (diff)
downloadnixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar.gz
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar.bz2
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar.lz
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar.xz
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.tar.zst
nixpkgs-6110a6009fc77348e9c47e0801a9b884dc76c730.zip
lib/modules: Add context to the "option does not exist" error
Add trace items that provide context for a failed definition that
can not be caught within the Nix language.

This also adds a test for the `tryEval` behavior of `showDefs`.
Diffstat (limited to 'lib/tests/modules.sh')
-rwxr-xr-xlib/tests/modules.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index 6d2eb24db55..75b316c9721 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -64,6 +64,9 @@ checkConfigOutput '^"one two"$' config.result ./shorthand-meta.nix
 # Check boolean option.
 checkConfigOutput '^false$' config.enable ./declare-enable.nix
 checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*: true' config.enable ./define-enable.nix
+checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*' config.enable ./define-enable-throw.nix
+checkConfigError 'while evaluating a definition from `.*/define-enable-abort.nix' config.enable ./define-enable-abort.nix
+checkConfigError 'while evaluating the error message for definitions for .enable., which is an option that does not exist' config.enable ./define-enable-abort.nix
 
 checkConfigOutput '^1$' config.bare-submodule.nested ./declare-bare-submodule.nix ./declare-bare-submodule-nested-option.nix
 checkConfigOutput '^2$' config.bare-submodule.deep ./declare-bare-submodule.nix ./declare-bare-submodule-deep-option.nix