diff options
author | h7x4 <h7x4@nani.wtf> | 2022-12-10 13:02:40 +0100 |
---|---|---|
committer | h7x4 <h7x4@nani.wtf> | 2022-12-10 13:16:45 +0100 |
commit | 62e863e98c8f5c22c0dd4ee3845613a858262b4c (patch) | |
tree | c2a04ea3dc037fd9661e564b701a744070b23fe0 /lib/tests/misc.nix | |
parent | 2bb2eec81373190a3f2de82aaa81beab3f08b649 (diff) | |
download | nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar.gz nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar.bz2 nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar.lz nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar.xz nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.tar.zst nixpkgs-62e863e98c8f5c22c0dd4ee3845613a858262b4c.zip |
lib.strings: fix negative number handling for `toInt` and `toIntBase10`
The previous version would be unstable due to an input validation regex not expecting a '-' in front of the number.
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r-- | lib/tests/misc.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 31c938a8ffd..8295f7bfdf9 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -339,6 +339,8 @@ runTests { (0 == toInt " 0") (0 == toInt "0 ") (0 == toInt " 0 ") + (-1 == toInt "-1") + (-1 == toInt " -1 ") ]; testToIntFails = testAllTrue [ @@ -383,6 +385,8 @@ runTests { (0 == toIntBase10 " 000000") (0 == toIntBase10 "000000 ") (0 == toIntBase10 " 000000 ") + (-1 == toIntBase10 "-1") + (-1 == toIntBase10 " -1 ") ]; testToIntBase10Fails = testAllTrue [ |