mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Ensure that process-tests clean up test processes
* test/src/process-tests.el (start-process-should-not-modify-arguments): Clean up test process. (process-test--check-pipe-process): New macro... (process-test-make-pipe-process-no-buffer): ... call it.
This commit is contained in:
parent
7626993c6f
commit
a557bf69b4
1 changed files with 21 additions and 10 deletions
|
|
@ -189,13 +189,17 @@ process to complete."
|
||||||
;; convert forward slashes to backslashes.
|
;; convert forward slashes to backslashes.
|
||||||
(expand-file-name (executable-find "attrib.exe")))
|
(expand-file-name (executable-find "attrib.exe")))
|
||||||
(_ "/bin//sh")))
|
(_ "/bin//sh")))
|
||||||
(samepath (copy-sequence path)))
|
(samepath (copy-sequence path))
|
||||||
;; Make sure 'start-process' actually goes all the way and invokes
|
(process (condition-case nil
|
||||||
;; the program.
|
(start-process "" nil path)
|
||||||
(should (process-live-p (condition-case nil
|
(error nil))))
|
||||||
(start-process "" nil path)
|
(unwind-protect
|
||||||
(error nil))))
|
(progn
|
||||||
(should (equal path samepath)))))
|
;; Make sure 'start-process' actually goes all the way and
|
||||||
|
;; invokes the program.
|
||||||
|
(should (process-live-p process))
|
||||||
|
(should (equal path samepath)))
|
||||||
|
(delete-process process)))))
|
||||||
|
|
||||||
(ert-deftest make-process/noquery-stderr ()
|
(ert-deftest make-process/noquery-stderr ()
|
||||||
"Checks that Bug#30031 is fixed."
|
"Checks that Bug#30031 is fixed."
|
||||||
|
|
@ -1056,11 +1060,18 @@ Return nil if FILENAME doesn't exist."
|
||||||
(should (integerp (num-processors)))
|
(should (integerp (num-processors)))
|
||||||
(should (< 0 (num-processors))))
|
(should (< 0 (num-processors))))
|
||||||
|
|
||||||
|
(defmacro process-test--check-pipe-process (args should-have-buffer)
|
||||||
|
`(let ((pipe-process (make-pipe-process ,@args)))
|
||||||
|
(unwind-protect
|
||||||
|
(,(if should-have-buffer 'should 'should-not)
|
||||||
|
(process-buffer pipe-process))
|
||||||
|
(delete-process pipe-process))))
|
||||||
|
|
||||||
(ert-deftest process-test-make-pipe-process-no-buffer ()
|
(ert-deftest process-test-make-pipe-process-no-buffer ()
|
||||||
"Test that a pipe process can be created without a buffer."
|
"Test that a pipe process can be created without a buffer."
|
||||||
(should (process-buffer (make-pipe-process :name "test")))
|
(process-test--check-pipe-process (:name "test") t)
|
||||||
(should (process-buffer (make-pipe-process :name "test" :buffer "test")))
|
(process-test--check-pipe-process (:name "test" :buffer "test") t)
|
||||||
(should-not (process-buffer (make-pipe-process :name "test" :buffer nil))))
|
(process-test--check-pipe-process (:name "test" :buffer nil) nil))
|
||||||
|
|
||||||
(provide 'process-tests)
|
(provide 'process-tests)
|
||||||
;;; process-tests.el ends here
|
;;; process-tests.el ends here
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue