1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

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)
This commit is contained in:
Robert Hensing 2023-12-23 11:40:16 +01:00
parent e525be5a07
commit 6f4d0b5261
2 changed files with 31 additions and 3 deletions

View file

@ -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";