about summary refs log tree commit diff
path: root/lib/tests/misc.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-12-23 11:40:16 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-12-23 11:40:27 +0100
commit6f4d0b52611812854394cecfee8081823b105e5b (patch)
tree149c8a0dd3d7e6efba307e83708bbb26bae61642 /lib/tests/misc.nix
parente525be5a078d47c9162963de7991042f096c4ed8 (diff)
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)
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r--lib/tests/misc.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index cf7fa9f2e2849..3059878ba0695 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";