diff options
| author | Glenn Morris | 2017-03-31 17:30:01 -0400 |
|---|---|---|
| committer | Glenn Morris | 2017-03-31 17:30:01 -0400 |
| commit | d23287a94913a3cc930a6d64eb8c7a101b98d8fd (patch) | |
| tree | f00e4e4f163e771fde5e5f7adfaed2fa52e26462 | |
| parent | 21918f4e1c5939038c7e8d0b8b8e8a647c086796 (diff) | |
| download | emacs-d23287a94913a3cc930a6d64eb8c7a101b98d8fd.tar.gz emacs-d23287a94913a3cc930a6d64eb8c7a101b98d8fd.zip | |
Tweak an ediff-ptch test
* test/lisp/vc/ediff-ptch-tests.el (ediff-ptch-test-bug26084):
Add skip conditions. Avoid going through shell where not needed.
| -rw-r--r-- | test/lisp/vc/ediff-ptch-tests.el | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index 9aacb6bd20f..aecfe30d947 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el | |||
| @@ -41,25 +41,28 @@ index 6a07f80..6e8e947 100644 | |||
| 41 | 41 | ||
| 42 | (ert-deftest ediff-ptch-test-bug26084 () | 42 | (ert-deftest ediff-ptch-test-bug26084 () |
| 43 | "Test for http://debbugs.gnu.org/26084 ." | 43 | "Test for http://debbugs.gnu.org/26084 ." |
| 44 | (let* ((tmpdir temporary-file-directory) | 44 | (skip-unless (executable-find "git")) |
| 45 | (foo (expand-file-name "foo" tmpdir)) | 45 | (skip-unless (executable-find ediff-patch-program)) |
| 46 | (patch (expand-file-name "foo.diff" tmpdir)) | 46 | (let* ((tmpdir (make-temp-file "ediff-ptch-test" t)) |
| 47 | (qux (expand-file-name "qux.txt" foo)) | 47 | (default-directory (file-name-as-directory tmpdir)) |
| 48 | (bar (expand-file-name "bar.txt" foo)) | 48 | (patch (make-temp-file "ediff-ptch-test")) |
| 49 | (cmd " | 49 | (qux (expand-file-name "qux.txt" tmpdir)) |
| 50 | mkdir -p foo | 50 | (bar (expand-file-name "bar.txt" tmpdir))) |
| 51 | cd foo | 51 | (with-temp-buffer |
| 52 | echo 'qux here' > qux.txt | 52 | (insert "qux here\n") |
| 53 | echo 'bar here' > bar.txt | 53 | (write-region nil nil qux nil 'silent) |
| 54 | git init | 54 | (erase-buffer) |
| 55 | git add . && git commit -m 'Test repository.' | 55 | (insert "bar here\n") |
| 56 | echo 'foo here' > qux.txt | 56 | (write-region nil nil bar nil 'silent)) |
| 57 | echo 'foo here' > bar.txt | 57 | (call-process "git" nil nil nil "init") |
| 58 | git diff > ../foo.diff | 58 | (call-process "git" nil nil nil "add" ".") |
| 59 | git reset --hard HEAD | 59 | (call-process "git" nil nil nil "commit" "-m" "Test repository.") |
| 60 | ")) | 60 | (with-temp-buffer |
| 61 | (setq default-directory tmpdir) | 61 | (insert "foo here\n") |
| 62 | (call-process-shell-command cmd) | 62 | (write-region nil nil qux nil 'silent) |
| 63 | (write-region nil nil bar nil 'silent)) | ||
| 64 | (call-process "git" nil `(:file ,patch) nil "diff") | ||
| 65 | (call-process "git" nil nil nil "reset" "--hard" "HEAD") | ||
| 63 | (find-file patch) | 66 | (find-file patch) |
| 64 | (unwind-protect | 67 | (unwind-protect |
| 65 | (let* ((info | 68 | (let* ((info |
| @@ -91,7 +94,7 @@ git reset --hard HEAD | |||
| 91 | (with-temp-buffer | 94 | (with-temp-buffer |
| 92 | (insert-file-contents (concat x ediff-backup-extension)) | 95 | (insert-file-contents (concat x ediff-backup-extension)) |
| 93 | (buffer-string)))))) | 96 | (buffer-string)))))) |
| 94 | (delete-directory foo 'recursive) | 97 | (delete-directory tmpdir 'recursive) |
| 95 | (delete-file patch)))) | 98 | (delete-file patch)))) |
| 96 | 99 | ||
| 97 | 100 | ||