From b16a69289aae7a8aeb7d0410649764d9d2328e2f Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 4 Apr 2018 16:51:46 +0200 Subject: [PATCH] lib/types: Add coercedTo unsound tests --- lib/tests/modules.sh | 5 +++++ lib/tests/modules/declare-coerced-value-unsound.nix | 10 ++++++++++ lib/tests/modules/define-value-string-arbitrary.nix | 3 +++ lib/tests/modules/define-value-string-bigint.nix | 3 +++ 4 files changed, 21 insertions(+) create mode 100644 lib/tests/modules/declare-coerced-value-unsound.nix create mode 100644 lib/tests/modules/define-value-string-arbitrary.nix create mode 100644 lib/tests/modules/define-value-string-bigint.nix diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 96a91c0fffb..45fd2d624e1 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -138,6 +138,11 @@ 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 +# 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 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix + cat <