diff options
| author | Ted Zlatanov | 2012-02-13 13:45:36 -0500 |
|---|---|---|
| committer | Ted Zlatanov | 2012-02-13 13:45:36 -0500 |
| commit | 6c0c7cfc6755342c15e0230747d7f0c697c899d9 (patch) | |
| tree | 7e508c62ef01da5ec4889dedf260a1e861c0c616 | |
| parent | c14fcc95713913de0fa9d84e3ed502bcb0b07c38 (diff) | |
| download | emacs-6c0c7cfc6755342c15e0230747d7f0c697c899d9.tar.gz emacs-6c0c7cfc6755342c15e0230747d7f0c697c899d9.zip | |
Move url-future.el ERT test to test/automated/url-future-tests.el.
* lisp/url/url-future.el (url-future-test): Move to test/automated.
* test/automated/url-future-tests.el (url-future-tests): Move from
lisp/url/url-future.el and rename.
| -rw-r--r-- | lisp/url/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/url/url-future.el | 27 | ||||
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/url-future-tests.el | 57 |
4 files changed, 66 insertions, 27 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 4f49adcd932..0340c954aea 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-02-13 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * url-future.el (url-future-test): Move to test/automated. | ||
| 4 | |||
| 1 | 2012-02-10 Lars Ingebrigtsen <larsi@gnus.org> | 5 | 2012-02-10 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 6 | ||
| 3 | * url-http.el (url-http-parse-headers): When redirecting, pass on | 7 | * url-http.el (url-http-parse-headers): When redirecting, pass on |
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el index 2798f936f21..f35399469c8 100644 --- a/lisp/url/url-future.el +++ b/lisp/url/url-future.el | |||
| @@ -95,32 +95,5 @@ | |||
| 95 | (signal 'error 'url-future-already-done) | 95 | (signal 'error 'url-future-already-done) |
| 96 | (url-future-finish url-future 'cancel))) | 96 | (url-future-finish url-future 'cancel))) |
| 97 | 97 | ||
| 98 | (ert-deftest url-future-test () | ||
| 99 | (let* (saver | ||
| 100 | (text "running future") | ||
| 101 | (good (make-url-future :value (lambda () (format text)) | ||
| 102 | :callback (lambda (f) (set 'saver f)))) | ||
| 103 | (bad (make-url-future :value (lambda () (/ 1 0)) | ||
| 104 | :errorback (lambda (&rest d) (set 'saver d)))) | ||
| 105 | (tocancel (make-url-future :value (lambda () (/ 1 0)) | ||
| 106 | :callback (lambda (f) (set 'saver f)) | ||
| 107 | :errorback (lambda (&rest d) | ||
| 108 | (set 'saver d))))) | ||
| 109 | (should (equal good (url-future-call good))) | ||
| 110 | (should (equal good saver)) | ||
| 111 | (should (equal text (url-future-value good))) | ||
| 112 | (should (url-future-completed-p good)) | ||
| 113 | (should-error (url-future-call good)) | ||
| 114 | (setq saver nil) | ||
| 115 | (should (equal bad (url-future-call bad))) | ||
| 116 | (should-error (url-future-call bad)) | ||
| 117 | (should (equal saver (list bad '(arith-error)))) | ||
| 118 | (should (url-future-errored-p bad)) | ||
| 119 | (setq saver nil) | ||
| 120 | (should (equal (url-future-cancel tocancel) tocancel)) | ||
| 121 | (should-error (url-future-call tocancel)) | ||
| 122 | (should (null saver)) | ||
| 123 | (should (url-future-cancelled-p tocancel)))) | ||
| 124 | |||
| 125 | (provide 'url-future) | 98 | (provide 'url-future) |
| 126 | ;;; url-future.el ends here | 99 | ;;; url-future.el ends here |
diff --git a/test/ChangeLog b/test/ChangeLog index 56b7ece59e5..f44b09102d9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-13 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * automated/url-future-tests.el (url-future-tests): Move from | ||
| 4 | lisp/url/url-future.el and rename. | ||
| 5 | |||
| 1 | 2012-01-29 Ulf Jasper <ulf.jasper@web.de> | 6 | 2012-01-29 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 7 | ||
| 3 | * automated/icalendar-tests.el (icalendar-import-non-recurring): | 8 | * automated/icalendar-tests.el (icalendar-import-non-recurring): |
diff --git a/test/automated/url-future-tests.el b/test/automated/url-future-tests.el new file mode 100644 index 00000000000..d499da6dbe2 --- /dev/null +++ b/test/automated/url-future-tests.el | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ;;; url-future-tests.el --- Test suite for url-future. | ||
| 2 | |||
| 3 | ;; Copyright (C) 2011-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Teodor Zlatanov <tzz@lifelogs.com> | ||
| 6 | ;; Keywords: data | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Code: | ||
| 24 | |||
| 25 | (require 'ert) | ||
| 26 | (require 'url-future) | ||
| 27 | |||
| 28 | (ert-deftest url-future-tests () | ||
| 29 | (let* (saver | ||
| 30 | (text "running future") | ||
| 31 | (good (make-url-future :value (lambda () (format text)) | ||
| 32 | :callback (lambda (f) (set 'saver f)))) | ||
| 33 | (bad (make-url-future :value (lambda () (/ 1 0)) | ||
| 34 | :errorback (lambda (&rest d) (set 'saver d)))) | ||
| 35 | (tocancel (make-url-future :value (lambda () (/ 1 0)) | ||
| 36 | :callback (lambda (f) (set 'saver f)) | ||
| 37 | :errorback (lambda (&rest d) | ||
| 38 | (set 'saver d))))) | ||
| 39 | (should (equal good (url-future-call good))) | ||
| 40 | (should (equal good saver)) | ||
| 41 | (should (equal text (url-future-value good))) | ||
| 42 | (should (url-future-completed-p good)) | ||
| 43 | (should-error (url-future-call good)) | ||
| 44 | (setq saver nil) | ||
| 45 | (should (equal bad (url-future-call bad))) | ||
| 46 | (should-error (url-future-call bad)) | ||
| 47 | (should (equal saver (list bad '(arith-error)))) | ||
| 48 | (should (url-future-errored-p bad)) | ||
| 49 | (setq saver nil) | ||
| 50 | (should (equal (url-future-cancel tocancel) tocancel)) | ||
| 51 | (should-error (url-future-call tocancel)) | ||
| 52 | (should (null saver)) | ||
| 53 | (should (url-future-cancelled-p tocancel)))) | ||
| 54 | |||
| 55 | (provide 'url-future-tests) | ||
| 56 | |||
| 57 | ;;; url-future-tests.el ends here | ||