Mercurial > hg > xemacs-beta
diff tests/automated/lisp-tests.el @ 5886:c96000075e49
Be more careful about C integer overflow, #'parse-integer.
src/ChangeLog addition:
2015-04-08 Aidan Kehoe <kehoea@parhasard.net>
* data.c (parse_integer):
Fix a bug in my detecting a C overflow here.
tests/ChangeLog addition:
2015-04-08 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Add a couple of tests for #'parse-integer to check for a bug just
fixed.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 08 Apr 2015 21:03:18 +0100 |
parents | e0f1dfaa821e |
children | bd644055ef44 a0e751d6c3ad |
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el Sat Apr 04 13:49:30 2015 +0100 +++ b/tests/automated/lisp-tests.el Wed Apr 08 21:03:18 2015 +0100 @@ -3606,6 +3606,14 @@ (Assert (equal (multiple-value-list (parse-integer "abc" :junk-allowed t)) '(nil 0))) + (Assert (eql (ignore-errors (parse-integer "100000000" + :radix 16)) + (if (featurep 'bignum) (lsh 1 32) nil)) + "checking an overflow bug has been fixed") + (Assert (eql (ignore-errors (parse-integer "-100000000" + :radix 16)) + (if (featurep 'bignum) (- (lsh 1 32) nil)) + "checking an overflow bug has been fixed, negative int") (Check-Error invalid-argument (parse-integer "0123456789" :radix 8)) (Check-Error invalid-argument (parse-integer "abc"))