diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/callproc-tests.el | 22 | ||||
| -rw-r--r-- | test/src/process-tests.el | 20 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el index 7b30a251cce..f351b6e2148 100644 --- a/test/src/callproc-tests.el +++ b/test/src/callproc-tests.el | |||
| @@ -37,3 +37,25 @@ | |||
| 37 | (split-string-and-unquote (buffer-string))) | 37 | (split-string-and-unquote (buffer-string))) |
| 38 | (should (equal initial-shell "nil")) | 38 | (should (equal initial-shell "nil")) |
| 39 | (should-not (equal initial-shell shell)))) | 39 | (should-not (equal initial-shell shell)))) |
| 40 | |||
| 41 | (ert-deftest call-process-w32-debug-spawn-error () | ||
| 42 | "Check that debugger runs on `call-process' failure (Bug#33016)." | ||
| 43 | (skip-unless (eq system-type 'windows-nt)) | ||
| 44 | (let* ((debug-on-error t) | ||
| 45 | (have-called-debugger nil) | ||
| 46 | (debugger (lambda (&rest _) | ||
| 47 | (setq have-called-debugger t) | ||
| 48 | ;; Allow entering the debugger later in the same | ||
| 49 | ;; test run, before going back to the command | ||
| 50 | ;; loop. | ||
| 51 | (setq internal-when-entered-debugger -1)))) | ||
| 52 | (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger. | ||
| 53 | (condition-case-unless-debug () | ||
| 54 | ;; On Windows, "nul.FOO" act like an always-empty | ||
| 55 | ;; file for any FOO, in any directory. So this | ||
| 56 | ;; passes Emacs' test for the file's existence, | ||
| 57 | ;; and ensures we hit an error in the w32 process | ||
| 58 | ;; spawn code. | ||
| 59 | (call-process "c:/nul.exe") | ||
| 60 | (error :got-error)))) | ||
| 61 | (should have-called-debugger))) | ||
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 5dbf441e8c2..0bb7ebe50a8 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -215,6 +215,26 @@ | |||
| 215 | (string-to-list "stdout\n") | 215 | (string-to-list "stdout\n") |
| 216 | (string-to-list "stderr\n")))))) | 216 | (string-to-list "stderr\n")))))) |
| 217 | 217 | ||
| 218 | (ert-deftest make-process-w32-debug-spawn-error () | ||
| 219 | "Check that debugger runs on `make-process' failure (Bug#33016)." | ||
| 220 | (skip-unless (eq system-type 'windows-nt)) | ||
| 221 | (let* ((debug-on-error t) | ||
| 222 | (have-called-debugger nil) | ||
| 223 | (debugger (lambda (&rest _) | ||
| 224 | (setq have-called-debugger t) | ||
| 225 | ;; Allow entering the debugger later in the same | ||
| 226 | ;; test run, before going back to the command | ||
| 227 | ;; loop. | ||
| 228 | (setq internal-when-entered-debugger -1)))) | ||
| 229 | (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger. | ||
| 230 | (condition-case-unless-debug () | ||
| 231 | ;; Emacs doesn't search for absolute filenames, so | ||
| 232 | ;; the error will be hit in the w32 process spawn | ||
| 233 | ;; code. | ||
| 234 | (make-process :name "test" :command '("c:/No-Such-Command")) | ||
| 235 | (error :got-error)))) | ||
| 236 | (should have-called-debugger))) | ||
| 237 | |||
| 218 | (ert-deftest make-process/file-handler/found () | 238 | (ert-deftest make-process/file-handler/found () |
| 219 | "Check that the ‘:file-handler’ argument of ‘make-process’ | 239 | "Check that the ‘:file-handler’ argument of ‘make-process’ |
| 220 | works as expected if a file name handler is found." | 240 | works as expected if a file name handler is found." |