about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2022-12-11 02:26:42 +0100
committerGitHub <noreply@github.com>2022-12-11 02:26:42 +0100
commitefa1140e8344212601b83182247b95b4b65fb00a (patch)
tree8121be1ffe8bfa5d5f5d8c3407a7b92667fe3e94 /lib/tests
parentea96faa08e470c2fa6ab233a89b3dbc9c7532869 (diff)
parent62e863e98c8f5c22c0dd4ee3845613a858262b4c (diff)
Merge pull request #205457 from h7x4/lib-strings-toInt-broken-for-negative-numbers
lib.strings: fix negative number handling for `toInt` and `toIntBase10`
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/misc.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 648c05ab35720..c719fcf5d4fae 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 [