summaryrefslogtreecommitdiff
path: root/test/lisp/net/network-stream-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2016-02-08 14:35:07 +1100
committerLars Ingebrigtsen <larsi@gnus.org>2016-02-08 14:35:07 +1100
commit4f50d8db8c54ca3fb80cd52c34099c4c0a8fb7dd (patch)
treed4f4e5bffbd2560aefc8245e5e4da4bf8b0fd425 /test/lisp/net/network-stream-tests.el
parent0cc907100cbf6b730935cf5beeb943943ab518e3 (diff)
downloademacs-4f50d8db8c54ca3fb80cd52c34099c4c0a8fb7dd.tar.gz
emacs-4f50d8db8c54ca3fb80cd52c34099c4c0a8fb7dd.tar.bz2
emacs-4f50d8db8c54ca3fb80cd52c34099c4c0a8fb7dd.zip
Add more network tests
* test/lisp/net/network-stream-tests.el (echo-server-nowait): New test.
Diffstat (limited to 'test/lisp/net/network-stream-tests.el')
-rw-r--r--test/lisp/net/network-stream-tests.el33
1 files changed, 28 insertions, 5 deletions
diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el
index 3e0821a8bd5..f52a69e05d6 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -75,7 +75,7 @@
:filter 'server-process-filter
:host host))
-(defun server-sentinel (proc msg)
+(defun server-sentinel (_proc _msg)
)
(defun server-process-filter (proc string)
@@ -95,7 +95,7 @@
))))
(ert-deftest echo-server-with-dns ()
- (let* ((server (make-server "mouse"))
+ (let* ((server (make-server (system-name)))
(port (aref (process-contact server :local) 4))
(proc (make-network-process :name "foo"
:buffer (generate-new-buffer "*foo*")
@@ -104,7 +104,8 @@
(with-current-buffer "*foo*"
(process-send-string proc "echo foo")
(sleep-for 0.1)
- (should (equal (buffer-string) "foo\n")))))
+ (should (equal (buffer-string) "foo\n")))
+ (delete-process server)))
(ert-deftest echo-server-with-localhost ()
(let* ((server (make-server 'local))
@@ -116,7 +117,8 @@
(with-current-buffer "*foo*"
(process-send-string proc "echo foo")
(sleep-for 0.1)
- (should (equal (buffer-string) "foo\n")))))
+ (should (equal (buffer-string) "foo\n")))
+ (delete-process server)))
(ert-deftest echo-server-with-ip ()
(let* ((server (make-server 'local))
@@ -128,6 +130,27 @@
(with-current-buffer "*foo*"
(process-send-string proc "echo foo")
(sleep-for 0.1)
- (should (equal (buffer-string) "foo\n")))))
+ (should (equal (buffer-string) "foo\n")))
+ (delete-process server)))
+
+(ert-deftest echo-server-nowait ()
+ (let* ((server (make-server 'local))
+ (port (aref (process-contact server :local) 4))
+ (proc (make-network-process :name "foo"
+ :buffer (generate-new-buffer "*foo*")
+ :host "localhost"
+ :nowait t
+ :service port)))
+ (should (eq (process-status proc) 'connect))
+ (should (null (ignore-errors
+ (process-send-string proc "echo bar")
+ t)))
+ (while (eq (process-status proc) 'connect)
+ (sit-for 0.1))
+ (with-current-buffer "*foo*"
+ (process-send-string proc "echo foo")
+ (sleep-for 0.1)
+ (should (equal (buffer-string) "foo\n")))
+ (delete-process server)))
;;; network-stream-tests.el ends here