diff options
| author | Ioannis Kappas | 2021-02-03 22:50:54 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2021-02-06 20:18:57 +0200 |
| commit | d640ec27183c9424daaf2d5dcb683ed1ff39d036 (patch) | |
| tree | 602bc1e2f789a1b245fc61a9bd0209b3549de921 /test/src | |
| parent | b76864ef5513a9c1f7fe1138266dfab47f6fe350 (diff) | |
| download | emacs-d640ec27183c9424daaf2d5dcb683ed1ff39d036.tar.gz emacs-d640ec27183c9424daaf2d5dcb683ed1ff39d036.zip | |
New test for src/process.c on MS-Windows
* test/src/process-tests.el (process-sentinel-interrupt-event):
New test. (Bug#46284)
Copyright-paperwork-exempt: yes
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/process-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index a3fba8d328b..950d0814c2a 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -879,5 +879,34 @@ Return nil if FILENAME doesn't exist." | |||
| 879 | (file-regular-p filename) | 879 | (file-regular-p filename) |
| 880 | filename))) | 880 | filename))) |
| 881 | 881 | ||
| 882 | ;; Bug#46284 | ||
| 883 | (ert-deftest process-sentinel-interrupt-event () | ||
| 884 | "Test that interrupting a process on MS-Windows sends the | ||
| 885 | \"interrupt\" event to the process sentinel." | ||
| 886 | (skip-unless (eq system-type 'windows-nt)) | ||
| 887 | (with-temp-buffer | ||
| 888 | (let* ((proc-buf (current-buffer)) | ||
| 889 | ;; Start a new emacs process to wait idly until interrupted. | ||
| 890 | (cmd "emacs -batch --eval=\"(sit-for 50000)\"") | ||
| 891 | (proc (start-file-process-shell-command | ||
| 892 | "test/process-sentinel-signal-event" proc-buf cmd)) | ||
| 893 | (events '())) | ||
| 894 | |||
| 895 | ;; Capture any incoming events. | ||
| 896 | (set-process-sentinel proc | ||
| 897 | (lambda (proc event) | ||
| 898 | (push event events))) | ||
| 899 | ;; Wait for the process to start. | ||
| 900 | (sleep-for 2) | ||
| 901 | (should (equal 'run (process-status proc))) | ||
| 902 | ;; Interrupt the sub-process and wait for it to die. | ||
| 903 | (interrupt-process proc) | ||
| 904 | (sleep-for 2) | ||
| 905 | ;; Should have received SIGINT... | ||
| 906 | (should (equal 'signal (process-status proc))) | ||
| 907 | (should (equal 2 (process-exit-status proc))) | ||
| 908 | ;; ...and the change description should be "interrupt". | ||
| 909 | (should (equal '("interrupt\n") events))))) | ||
| 910 | |||
| 882 | (provide 'process-tests) | 911 | (provide 'process-tests) |
| 883 | ;;; process-tests.el ends here | 912 | ;;; process-tests.el ends here |