diff options
| author | Glenn Morris | 2014-05-11 23:59:30 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-05-11 23:59:30 -0700 |
| commit | bbbabffe06d4c763534d5be92844c48a3f8746e2 (patch) | |
| tree | a6fffb13638948223f3142e5209cbce57282fbbd /test/automated | |
| parent | ffd6d9c4d321e93e301f9cafd1fe054389898978 (diff) | |
| parent | 96b894717caa773aa6d98ff57385f1c7537e8972 (diff) | |
| download | emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.tar.gz emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.zip | |
Merge from emacs-24; up to 2014-05-12T06:15:47Z!rgm@gnu.org
Diffstat (limited to 'test/automated')
| -rw-r--r-- | test/automated/advice-tests.el | 23 | ||||
| -rw-r--r-- | test/automated/vc-bzr.el | 15 |
2 files changed, 31 insertions, 7 deletions
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el index f755e8defef..e0c3b40487e 100644 --- a/test/automated/advice-tests.el +++ b/test/automated/advice-tests.el | |||
| @@ -179,6 +179,29 @@ function being an around advice." | |||
| 179 | (interactive "P") nil) | 179 | (interactive "P") nil) |
| 180 | (should (equal (interactive-form 'sm-test9) '(interactive "P")))) | 180 | (should (equal (interactive-form 'sm-test9) '(interactive "P")))) |
| 181 | 181 | ||
| 182 | (ert-deftest advice-test-multiples () | ||
| 183 | (let ((sm-test10 (lambda (a) (+ a 10))) | ||
| 184 | (sm-advice (lambda (x) (if (consp x) (list (* 5 (car x))) (* 4 x))))) | ||
| 185 | (should (equal (funcall sm-test10 5) 15)) | ||
| 186 | (add-function :filter-args (var sm-test10) sm-advice) | ||
| 187 | (should (equal (funcall sm-test10 5) 35)) | ||
| 188 | (add-function :filter-return (var sm-test10) sm-advice) | ||
| 189 | (should (equal (funcall sm-test10 5) 60)) | ||
| 190 | ;; Make sure we can add multiple times the same function, under the | ||
| 191 | ;; condition that they have different `name' properties. | ||
| 192 | (add-function :filter-args (var sm-test10) sm-advice '((name . "args"))) | ||
| 193 | (should (equal (funcall sm-test10 5) 140)) | ||
| 194 | (remove-function (var sm-test10) "args") | ||
| 195 | (should (equal (funcall sm-test10 5) 60)) | ||
| 196 | (add-function :filter-args (var sm-test10) sm-advice '((name . "args"))) | ||
| 197 | (add-function :filter-return (var sm-test10) sm-advice '((name . "ret"))) | ||
| 198 | (should (equal (funcall sm-test10 5) 560)) | ||
| 199 | ;; Make sure that if we specify to remove a function that was added | ||
| 200 | ;; multiple times, they are all removed, rather than removing only some | ||
| 201 | ;; arbitrary subset of them. | ||
| 202 | (remove-function (var sm-test10) sm-advice) | ||
| 203 | (should (equal (funcall sm-test10 5) 15)))) | ||
| 204 | |||
| 182 | ;; Local Variables: | 205 | ;; Local Variables: |
| 183 | ;; no-byte-compile: t | 206 | ;; no-byte-compile: t |
| 184 | ;; End: | 207 | ;; End: |
diff --git a/test/automated/vc-bzr.el b/test/automated/vc-bzr.el index 07e821064ca..4c16465d54b 100644 --- a/test/automated/vc-bzr.el +++ b/test/automated/vc-bzr.el | |||
| @@ -33,17 +33,18 @@ | |||
| 33 | (skip-unless (executable-find vc-bzr-program)) | 33 | (skip-unless (executable-find vc-bzr-program)) |
| 34 | ;; Bzr wants to access HOME, e.g. to write ~/.bzr.log. | 34 | ;; Bzr wants to access HOME, e.g. to write ~/.bzr.log. |
| 35 | ;; This is a problem on hydra, where HOME is non-existent. | 35 | ;; This is a problem on hydra, where HOME is non-existent. |
| 36 | ;; You can disable logging with BZR_LOG=/dev/null, but then | 36 | ;; You can disable logging with BZR_LOG=/dev/null, but then some |
| 37 | ;; some commands (eg `bzr status') want to access ~/.bazaar, | 37 | ;; commands (eg `bzr status') want to access ~/.bazaar, and will |
| 38 | ;; and will abort if they cannot. I could not figure out how to | 38 | ;; abort if they cannot. I could not figure out how to stop bzr |
| 39 | ;; stop bzr doing that, so just set HOME to a tempir for the duration. | 39 | ;; doing that, so just give it a temporary homedir for the duration. |
| 40 | ;; http://bugs.launchpad.net/bzr/+bug/137407 ? | ||
| 40 | (let* ((homedir (make-temp-file "vc-bzr-test" t)) | 41 | (let* ((homedir (make-temp-file "vc-bzr-test" t)) |
| 41 | (bzrdir (expand-file-name "bzr" homedir)) | 42 | (bzrdir (expand-file-name "bzr" homedir)) |
| 42 | (ignored-dir (progn | 43 | (ignored-dir (progn |
| 43 | (make-directory bzrdir) | 44 | (make-directory bzrdir) |
| 44 | (expand-file-name "ignored-dir" bzrdir))) | 45 | (expand-file-name "ignored-dir" bzrdir))) |
| 45 | (default-directory (file-name-as-directory bzrdir)) | 46 | (default-directory (file-name-as-directory bzrdir)) |
| 46 | (process-environment (cons (format "HOME=%s" homedir) | 47 | (process-environment (cons (format "BZR_HOME=%s" homedir) |
| 47 | process-environment))) | 48 | process-environment))) |
| 48 | (unwind-protect | 49 | (unwind-protect |
| 49 | (progn | 50 | (progn |
| @@ -79,7 +80,7 @@ | |||
| 79 | (expand-file-name "subdir" bzrdir))) | 80 | (expand-file-name "subdir" bzrdir))) |
| 80 | (file (expand-file-name "file" bzrdir)) | 81 | (file (expand-file-name "file" bzrdir)) |
| 81 | (default-directory (file-name-as-directory bzrdir)) | 82 | (default-directory (file-name-as-directory bzrdir)) |
| 82 | (process-environment (cons (format "HOME=%s" homedir) | 83 | (process-environment (cons (format "BZR_HOME=%s" homedir) |
| 83 | process-environment))) | 84 | process-environment))) |
| 84 | (unwind-protect | 85 | (unwind-protect |
| 85 | (progn | 86 | (progn |
| @@ -120,7 +121,7 @@ | |||
| 120 | (expand-file-name "foo.el" bzrdir))) | 121 | (expand-file-name "foo.el" bzrdir))) |
| 121 | (default-directory (file-name-as-directory bzrdir)) | 122 | (default-directory (file-name-as-directory bzrdir)) |
| 122 | (generated-autoload-file (expand-file-name "loaddefs.el" bzrdir)) | 123 | (generated-autoload-file (expand-file-name "loaddefs.el" bzrdir)) |
| 123 | (process-environment (cons (format "HOME=%s" homedir) | 124 | (process-environment (cons (format "BZR_HOME=%s" homedir) |
| 124 | process-environment))) | 125 | process-environment))) |
| 125 | (unwind-protect | 126 | (unwind-protect |
| 126 | (progn | 127 | (progn |