diff options
| author | Joakim Verona | 2012-02-15 15:12:49 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-02-15 15:12:49 +0100 |
| commit | 02db17e53bf46c91b2cb8ee33b43d8ae252a1681 (patch) | |
| tree | fcafa961e884648e15524130f1dbca55dc7093d0 /test | |
| parent | 736ab04e2752e7c3c5b5070a0d62279dcfb12b27 (diff) | |
| parent | 1deeb569b1247db4c0b2eea4906a9e53e5ee7e99 (diff) | |
| download | emacs-02db17e53bf46c91b2cb8ee33b43d8ae252a1681.tar.gz emacs-02db17e53bf46c91b2cb8ee33b43d8ae252a1681.zip | |
upstream
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/url-future-tests.el | 57 |
2 files changed, 62 insertions, 0 deletions
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 | ||