diff options
| author | Tino Calancha | 2017-04-01 12:28:54 +0900 |
|---|---|---|
| committer | Tino Calancha | 2017-04-01 12:28:54 +0900 |
| commit | 226cafd24df9c233f6359c93273d4da22db7f62d (patch) | |
| tree | 3e383f84644ad45f4a5f2eb0a27a63bfbbe11121 | |
| parent | d23287a94913a3cc930a6d64eb8c7a101b98d8fd (diff) | |
| download | emacs-226cafd24df9c233f6359c93273d4da22db7f62d.tar.gz emacs-226cafd24df9c233f6359c93273d4da22db7f62d.zip | |
Tweak ediff-ptch test in previous commit a bit more
* test/lisp/vc/ediff-ptch-tests.el (ediff-ptch-test-bug26084):
Apply patches without requiring a shell. Add some comments.
| -rw-r--r-- | test/lisp/vc/ediff-ptch-tests.el | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index aecfe30d947..7372a72021a 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el | |||
| @@ -47,22 +47,25 @@ index 6a07f80..6e8e947 100644 | |||
| 47 | (default-directory (file-name-as-directory tmpdir)) | 47 | (default-directory (file-name-as-directory tmpdir)) |
| 48 | (patch (make-temp-file "ediff-ptch-test")) | 48 | (patch (make-temp-file "ediff-ptch-test")) |
| 49 | (qux (expand-file-name "qux.txt" tmpdir)) | 49 | (qux (expand-file-name "qux.txt" tmpdir)) |
| 50 | (bar (expand-file-name "bar.txt" tmpdir))) | 50 | (bar (expand-file-name "bar.txt" tmpdir)) |
| 51 | (git-program (executable-find "git"))) | ||
| 52 | ;; Create repository. | ||
| 51 | (with-temp-buffer | 53 | (with-temp-buffer |
| 52 | (insert "qux here\n") | 54 | (insert "qux here\n") |
| 53 | (write-region nil nil qux nil 'silent) | 55 | (write-region nil nil qux nil 'silent) |
| 54 | (erase-buffer) | 56 | (erase-buffer) |
| 55 | (insert "bar here\n") | 57 | (insert "bar here\n") |
| 56 | (write-region nil nil bar nil 'silent)) | 58 | (write-region nil nil bar nil 'silent)) |
| 57 | (call-process "git" nil nil nil "init") | 59 | (call-process git-program nil nil nil "init") |
| 58 | (call-process "git" nil nil nil "add" ".") | 60 | (call-process git-program nil nil nil "add" ".") |
| 59 | (call-process "git" nil nil nil "commit" "-m" "Test repository.") | 61 | (call-process git-program nil nil nil "commit" "-m" "Test repository.") |
| 62 | ;; Update repo., save the diff and reset to initial state. | ||
| 60 | (with-temp-buffer | 63 | (with-temp-buffer |
| 61 | (insert "foo here\n") | 64 | (insert "foo here\n") |
| 62 | (write-region nil nil qux nil 'silent) | 65 | (write-region nil nil qux nil 'silent) |
| 63 | (write-region nil nil bar nil 'silent)) | 66 | (write-region nil nil bar nil 'silent)) |
| 64 | (call-process "git" nil `(:file ,patch) nil "diff") | 67 | (call-process git-program nil `(:file ,patch) nil "diff") |
| 65 | (call-process "git" nil nil nil "reset" "--hard" "HEAD") | 68 | (call-process git-program nil nil nil "reset" "--hard" "HEAD") |
| 66 | (find-file patch) | 69 | (find-file patch) |
| 67 | (unwind-protect | 70 | (unwind-protect |
| 68 | (let* ((info | 71 | (let* ((info |
| @@ -79,13 +82,12 @@ index 6a07f80..6e8e947 100644 | |||
| 79 | (dolist (x (list (cons patch1 bar) (cons patch2 qux))) | 82 | (dolist (x (list (cons patch1 bar) (cons patch2 qux))) |
| 80 | (with-temp-buffer | 83 | (with-temp-buffer |
| 81 | (insert (car x)) | 84 | (insert (car x)) |
| 82 | (call-shell-region (point-min) | 85 | (call-process-region (point-min) |
| 83 | (point-max) | 86 | (point-max) |
| 84 | (format "%s %s %s %s" | 87 | ediff-patch-program |
| 85 | ediff-patch-program | 88 | nil nil nil |
| 86 | ediff-patch-options | 89 | "-f" "-z.orig" "-b" |
| 87 | ediff-backup-specs | 90 | (cdr x)))) |
| 88 | (cdr x))))) | ||
| 89 | ;; Check backup files were saved correctly. | 91 | ;; Check backup files were saved correctly. |
| 90 | (dolist (x (list qux bar)) | 92 | (dolist (x (list qux bar)) |
| 91 | (should-not (string= (with-temp-buffer | 93 | (should-not (string= (with-temp-buffer |