diff options
| author | Leo Liu | 2014-09-26 08:15:21 +0800 |
|---|---|---|
| committer | Leo Liu | 2014-09-26 08:15:21 +0800 |
| commit | 89b354a55e30978444ada5d388e18f5e06bde583 (patch) | |
| tree | 0f272431b9522c96aeff74b5d262869d26c4bc3f /test | |
| parent | b8e352d077f14c52d7e6baa1800def8d3ec61f06 (diff) | |
| download | emacs-89b354a55e30978444ada5d388e18f5e06bde583.tar.gz emacs-89b354a55e30978444ada5d388e18f5e06bde583.zip | |
Add cl-parse-integer based on parse-integer
* doc/misc/cl.texi (Predicates on Numbers): Document cl-digit-char-p.
(Numerical Functions): Document cl-parse-integer.
* lisp/calendar/parse-time.el (parse-time-digits): Remove.
(digit-char-p, parse-integer) Moved to cl-lib.el.
(parse-time-tokenize, parse-time-rules, parse-time-string): Use
cl-parse-integer.
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer): New function.
* lisp/emacs-lisp/cl-lib.el (cl-digit-char-table): New var.
(cl-digit-char-p): New function.
* test/automated/cl-lib.el (cl-digit-char-p, cl-parse-integer): New
tests.
Fixes: debbugs:18557
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/cl-lib.el | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 6d64da10a33..041ed7c1754 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-09-26 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * automated/cl-lib.el (cl-digit-char-p, cl-parse-integer): New | ||
| 4 | tests. (Bug#18557) | ||
| 5 | |||
| 1 | 2014-09-24 Ulf Jasper <ulf.jasper@web.de> | 6 | 2014-09-24 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 7 | ||
| 3 | * automated/newsticker-tests.el | 8 | * automated/newsticker-tests.el |
diff --git a/test/automated/cl-lib.el b/test/automated/cl-lib.el index 6bbd9a5e81d..e4c6e914ee2 100644 --- a/test/automated/cl-lib.el +++ b/test/automated/cl-lib.el | |||
| @@ -223,6 +223,25 @@ | |||
| 223 | (should (= (cl-the integer (cl-incf side-effect)) 1)) | 223 | (should (= (cl-the integer (cl-incf side-effect)) 1)) |
| 224 | (should (= side-effect 1)))) | 224 | (should (= side-effect 1)))) |
| 225 | 225 | ||
| 226 | (ert-deftest cl-digit-char-p () | ||
| 227 | (should (cl-digit-char-p ?3)) | ||
| 228 | (should (cl-digit-char-p ?a 11)) | ||
| 229 | (should-not (cl-digit-char-p ?a)) | ||
| 230 | (should (cl-digit-char-p ?w 36)) | ||
| 231 | (should-error (cl-digit-char-p ?a 37)) | ||
| 232 | (should-error (cl-digit-char-p ?a 1))) | ||
| 233 | |||
| 234 | (ert-deftest cl-parse-integer () | ||
| 235 | (should-error (cl-parse-integer "abc")) | ||
| 236 | (should (null (cl-parse-integer "abc" :junk-allowed t))) | ||
| 237 | (should (null (cl-parse-integer "" :junk-allowed t))) | ||
| 238 | (should (= 342391 (cl-parse-integer "0123456789" :radix 8 :junk-allowed t))) | ||
| 239 | (should-error (cl-parse-integer "0123456789" :radix 8)) | ||
| 240 | (should (= -239 (cl-parse-integer "-efz" :radix 16 :junk-allowed t))) | ||
| 241 | (should-error (cl-parse-integer "efz" :radix 16)) | ||
| 242 | (should (= 239 (cl-parse-integer "zzef" :radix 16 :start 2))) | ||
| 243 | (should (= -123 (cl-parse-integer " -123 ")))) | ||
| 244 | |||
| 226 | (ert-deftest cl-loop-destructuring-with () | 245 | (ert-deftest cl-loop-destructuring-with () |
| 227 | (should (equal (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6))) | 246 | (should (equal (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6))) |
| 228 | 247 | ||