diff options
| author | Joakim Verona | 2015-01-16 22:29:10 +0100 |
|---|---|---|
| committer | Joakim Verona | 2015-01-16 22:29:10 +0100 |
| commit | 5e2255017323c54feeaaee220175d7761a3b6ed1 (patch) | |
| tree | 3f843af60b826b63e12482301ce20745a95ede3e /test | |
| parent | b64675500decba1c707bc5d5c6d57f633934778f (diff) | |
| parent | 78e6ccc4a5006272b14f352e459a6d3bf52ed07b (diff) | |
| download | emacs-5e2255017323c54feeaaee220175d7761a3b6ed1.tar.gz emacs-5e2255017323c54feeaaee220175d7761a3b6ed1.zip | |
merge master
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 16 | ||||
| -rw-r--r-- | test/automated/Makefile.in | 2 | ||||
| -rw-r--r-- | test/automated/calc-tests.el | 52 | ||||
| -rw-r--r-- | test/automated/package-test.el | 17 |
4 files changed, 86 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index a33ec8793f4..8ed02ee341b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2015-01-16 Jorgen Schaefer <contact@jorgenschaefer.de> | ||
| 2 | |||
| 3 | * automated/package-test.el (package-test-install-prioritized): | ||
| 4 | New test. | ||
| 5 | |||
| 6 | 2015-01-15 Wolfgang Jenkner <wjenkner@inode.at> | ||
| 7 | |||
| 8 | * automated/calc-tests.el (calc-tests-equal, calc-tests-simple): | ||
| 9 | New functions. | ||
| 10 | (test-calc-remove-units, test-calc-extract-units) | ||
| 11 | (test-calc-convert-units): New tests. | ||
| 12 | |||
| 13 | 2015-01-15 Wolfgang Jenkner <wjenkner@inode.at> | ||
| 14 | |||
| 15 | * automated/Makefile.in (WRITE_LOG): Use POSIX redirection. | ||
| 16 | |||
| 1 | 2015-01-15 Stefan Monnier <monnier@iro.umontreal.ca> | 17 | 2015-01-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 18 | ||
| 3 | * automated/eieio-test-methodinvoke.el (eieio-test-method-store): Add | 19 | * automated/eieio-test-methodinvoke.el (eieio-test-method-store): Add |
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in index ed757817ae0..7243e8af14a 100644 --- a/test/automated/Makefile.in +++ b/test/automated/Makefile.in | |||
| @@ -64,7 +64,7 @@ all: check | |||
| 64 | 64 | ||
| 65 | ## Ignore any test errors so we can continue to test other files. | 65 | ## Ignore any test errors so we can continue to test other files. |
| 66 | ## But compilation errors are always fatal. | 66 | ## But compilation errors are always fatal. |
| 67 | WRITE_LOG = >& $@ || { stat=ERROR; cat $@; }; echo $$stat: $@ | 67 | WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@ |
| 68 | 68 | ||
| 69 | ## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather | 69 | ## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather |
| 70 | ## than || true, since the former makes problems more obvious. | 70 | ## than || true, since the former makes problems more obvious. |
diff --git a/test/automated/calc-tests.el b/test/automated/calc-tests.el index 331e01e4640..d5252ea62a9 100644 --- a/test/automated/calc-tests.el +++ b/test/automated/calc-tests.el | |||
| @@ -27,6 +27,40 @@ | |||
| 27 | (require 'cl-lib) | 27 | (require 'cl-lib) |
| 28 | (require 'ert) | 28 | (require 'ert) |
| 29 | (require 'calc) | 29 | (require 'calc) |
| 30 | (require 'calc-ext) | ||
| 31 | (require 'calc-units) | ||
| 32 | |||
| 33 | ;; XXX The order in which calc libraries (in particular calc-units) | ||
| 34 | ;; are loaded influences whether a calc integer in an expression | ||
| 35 | ;; involving units is represented as a lisp integer or a calc float, | ||
| 36 | ;; see bug#19582. Until this will be fixed the following function can | ||
| 37 | ;; be used to compare such calc expressions. | ||
| 38 | (defun calc-tests-equal (a b) | ||
| 39 | "Like `equal' but allow for different representations of numbers. | ||
| 40 | For example: (calc-tests-equal 10 '(float 1 1)) => t. | ||
| 41 | A and B should be calc expressions." | ||
| 42 | (cond ((math-numberp a) | ||
| 43 | (and (math-numberp b) | ||
| 44 | (math-equal a b))) | ||
| 45 | ((atom a) | ||
| 46 | (equal a b)) | ||
| 47 | ((consp b) | ||
| 48 | ;; Can't be dotted or circular. | ||
| 49 | (and (= (length a) (length b)) | ||
| 50 | (equal (car a) (car b)) | ||
| 51 | (cl-every #'calc-tests-equal (cdr a) (cdr b)))))) | ||
| 52 | |||
| 53 | (defun calc-tests-simple (fun string &rest args) | ||
| 54 | "Push STRING on the calc stack, then call FUN and return the new top. | ||
| 55 | The result is a calc (i.e., lisp) expression, not its string representation. | ||
| 56 | Also pop the entire stack afterwards. | ||
| 57 | An existing calc stack is reused, otherwise a new one is created." | ||
| 58 | (calc-eval string 'push) | ||
| 59 | (prog1 | ||
| 60 | (ignore-errors | ||
| 61 | (apply fun args) | ||
| 62 | (calc-top-n 1)) | ||
| 63 | (calc-pop 0))) | ||
| 30 | 64 | ||
| 31 | (ert-deftest test-math-bignum () | 65 | (ert-deftest test-math-bignum () |
| 32 | ;; bug#17556 | 66 | ;; bug#17556 |
| @@ -34,6 +68,24 @@ | |||
| 34 | (should (math-negp n)) | 68 | (should (math-negp n)) |
| 35 | (should (cl-notany #'cl-minusp (cdr n))))) | 69 | (should (cl-notany #'cl-minusp (cdr n))))) |
| 36 | 70 | ||
| 71 | (ert-deftest test-calc-remove-units () | ||
| 72 | (should (calc-tests-equal (calc-tests-simple #'calc-remove-units "-1 m") -1))) | ||
| 73 | |||
| 74 | (ert-deftest test-calc-extract-units () | ||
| 75 | (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m") | ||
| 76 | '(var m var-m))) | ||
| 77 | (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m*cm") | ||
| 78 | '(* (float 1 -2) (^ (var m var-m) 2))))) | ||
| 79 | |||
| 80 | (ert-deftest test-calc-convert-units () | ||
| 81 | ;; Used to ask for `(The expression is unitless when simplified) Old Units: '. | ||
| 82 | (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" nil "cm") | ||
| 83 | '(* -100 (var cm var-cm)))) | ||
| 84 | ;; Gave wrong result. | ||
| 85 | (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" | ||
| 86 | (math-read-expr "1m") "cm") | ||
| 87 | '(* -100 (var cm var-cm))))) | ||
| 88 | |||
| 37 | (provide 'calc-tests) | 89 | (provide 'calc-tests) |
| 38 | ;;; calc-tests.el ends here | 90 | ;;; calc-tests.el ends here |
| 39 | 91 | ||
diff --git a/test/automated/package-test.el b/test/automated/package-test.el index 27a71c528c6..c33a1ba0232 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el | |||
| @@ -230,6 +230,23 @@ Must called from within a `tar-mode' buffer." | |||
| 230 | (package-refresh-contents) | 230 | (package-refresh-contents) |
| 231 | (package-install 'simple-single))) | 231 | (package-install 'simple-single))) |
| 232 | 232 | ||
| 233 | (ert-deftest package-test-install-prioritized () | ||
| 234 | "Install a lower version from a higher-prioritized archive." | ||
| 235 | (with-package-test () | ||
| 236 | (let* ((newer-version (expand-file-name "data/package/newer-versions" | ||
| 237 | package-test-file-dir)) | ||
| 238 | (package-archives `(("older" . ,package-test-data-dir) | ||
| 239 | ("newer" . ,newer-version))) | ||
| 240 | (package-archive-priorities '(("newer" . 100)))) | ||
| 241 | |||
| 242 | (package-initialize) | ||
| 243 | (package-refresh-contents) | ||
| 244 | (package-install 'simple-single) | ||
| 245 | |||
| 246 | (let ((installed (cadr (assq 'simple-single package-alist)))) | ||
| 247 | (should (version-list-= '(1 3) | ||
| 248 | (package-desc-version installed))))))) | ||
| 249 | |||
| 233 | (ert-deftest package-test-install-multifile () | 250 | (ert-deftest package-test-install-multifile () |
| 234 | "Check properties of the installed multi-file package." | 251 | "Check properties of the installed multi-file package." |
| 235 | (with-package-test (:basedir "data/package" :install '(multi-file)) | 252 | (with-package-test (:basedir "data/package" :install '(multi-file)) |