diff options
author | Robert Hensing <robert@roberthensing.nl> | 2024-02-04 18:09:51 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2024-04-04 11:54:46 +0200 |
commit | 1465777b63d38988d5ecd81683d2975321e59d1a (patch) | |
tree | 715bb4968c6cce5fb4d113fc87614b82c08dde57 /lib/tests | |
parent | bcd774606a257fd6f14bda50effac67474005447 (diff) |
lib.types.attrTag: Custom error when passing bare type
Diffstat (limited to 'lib/tests')
-rwxr-xr-x | lib/tests/modules.sh | 1 | ||||
-rw-r--r-- | lib/tests/modules/types-attrTag-wrong-decl.nix | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index b1994ff316383..f5f7e907d277a 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -113,6 +113,7 @@ checkConfigError 'A definition for option .intStrings\.mergeError. is not of typ checkConfigError 'A definition for option .intStrings\.badTagError. is not of type .attribute-tagged union' config.intStrings.badTagError ./types-attrTag.nix checkConfigError 'A definition for option .intStrings\.badTagTypeError\.left. is not of type .signed integer.' config.intStrings.badTagTypeError.left ./types-attrTag.nix checkConfigError 'A definition for option .nested\.right\.left. is not of type .signed integer.' config.nested.right.left ./types-attrTag.nix +checkConfigError 'In attrTag/attrTagWith, each tag value must be an option, but tag int was a bare type, not wrapped in mkOption.' config.opt.int ./types-attrTag-wrong-decl.nix # types.pathInStore checkConfigOutput '".*/store/0lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv"' config.pathInStore.ok1 ./types.nix diff --git a/lib/tests/modules/types-attrTag-wrong-decl.nix b/lib/tests/modules/types-attrTag-wrong-decl.nix new file mode 100644 index 0000000000000..d03370bc10da4 --- /dev/null +++ b/lib/tests/modules/types-attrTag-wrong-decl.nix @@ -0,0 +1,14 @@ +{ lib, ... }: +let + inherit (lib) types mkOption; +in +{ + options = { + opt = mkOption { + type = types.attrTag { + int = types.int; + }; + default = { int = 1; }; + }; + }; +} |