diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2018-04-04 16:55:45 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2018-05-06 23:58:36 +0200 |
commit | cd5736116c971ed08826b71a15a2221233b3d44f (patch) | |
tree | 936800e16966c98d6cbdbf555669ac89c5db7574 /lib | |
parent | b16a69289aae7a8aeb7d0410649764d9d2328e2f (diff) | |
download | nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar.gz nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar.bz2 nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar.lz nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar.xz nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.tar.zst nixlib-cd5736116c971ed08826b71a15a2221233b3d44f.zip |
lib/types: clear up coercedTo description
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/tests/modules.sh | 4 | ||||
-rw-r--r-- | lib/types.nix | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 45fd2d624e1e..c6b3fd912a9b 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -136,11 +136,11 @@ checkConfigOutput "true" "$@" ./define-module-check.nix # Check coerced value. checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix -checkConfigError 'The option value .* in .* is not.*string or signed integer.*' config.value ./declare-coerced-value.nix ./define-value-list.nix +checkConfigError 'The option value .* in .* is not.*string or signed integer convertible to it' config.value ./declare-coerced-value.nix ./define-value-list.nix # Check coerced value with unsound coercion checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix -checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string.*' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix +checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string convertible to it' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix cat <<EOF diff --git a/lib/types.nix b/lib/types.nix index 45b0ae5042ce..4ee9affcb297 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -256,7 +256,7 @@ rec { functor = (defaultFunctor name) // { wrapped = elemType; }; }; - nonEmptyListOf = elemType: + nonEmptyListOf = elemType: let list = addCheck (types.listOf elemType) (l: l != []); in list // { description = "non-empty " + list.description; }; @@ -419,7 +419,7 @@ rec { assert coercedType.getSubModules == null; mkOptionType rec { name = "coercedTo"; - description = "${finalType.description} or ${coercedType.description}"; + description = "${finalType.description} or ${coercedType.description} convertible to it"; check = x: finalType.check x || (coercedType.check x && finalType.check (coerceFunc x)); merge = loc: defs: let |