From 6f4d0b52611812854394cecfee8081823b105e5b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 23 Dec 2023 11:40:16 +0100 Subject: lib.types: Improve descriptions of composed types that have commas Type: either ints.positive (enum ["auto"]) Before: positive integer, meaning >0 or value "auto" (singular enum) After: positive integer, meaning >0, or value "auto" (singular enum) --- lib/tests/misc.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/tests/misc.nix') diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index cf7fa9f2e284..3059878ba069 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -1959,6 +1959,18 @@ runTests { expr = (with types; int).description; expected = "signed integer"; }; + testTypeDescriptionIntsPositive = { + expr = (with types; ints.positive).description; + expected = "positive integer, meaning >0"; + }; + testTypeDescriptionIntsPositiveOrEnumAuto = { + expr = (with types; either ints.positive (enum ["auto"])).description; + expected = ''positive integer, meaning >0, or value "auto" (singular enum)''; + }; + testTypeDescriptionListOfPositive = { + expr = (with types; listOf ints.positive).description; + expected = "list of (positive integer, meaning >0)"; + }; testTypeDescriptionListOfInt = { expr = (with types; listOf int).description; expected = "list of signed integer"; -- cgit 1.4.1