emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 28/119: testing a hello-world server


From: Eric Schulte
Subject: [elpa] 28/119: testing a hello-world server
Date: Mon, 10 Mar 2014 16:57:09 +0000

eschulte pushed a commit to branch master
in repository elpa.

commit 5ceb982abcb2c54f8792f9330d21f28968b04f18
Author: Eric Schulte <address@hidden>
Date:   Thu Dec 19 21:06:06 2013 -0700

    testing a hello-world server
---
 emacs-web-server-test.el |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/emacs-web-server-test.el b/emacs-web-server-test.el
index 594d0c2..efe0cb3 100644
--- a/emacs-web-server-test.el
+++ b/emacs-web-server-test.el
@@ -25,6 +25,25 @@
                                    (buffer-string))
                             (kill-buffer buf)))))))))
 
+(defvar ews-test-port 8999)
+
+(ert-deftest ews/hello-world-server ()
+  "Test that a simple hello-world server responds."
+  (lexical-let
+      ((server
+        (ews-start
+         '(((lambda (_) t) .
+            (lambda (proc request)
+              (ews-response-header proc 200 '("Content-type" . "text/plain"))
+              (process-send-string proc "hello world")
+              :finished)))
+         ews-test-port)))
+    (ews-test-run-asynch
+     (lambda (response)
+       (should (string= response "hello world"))
+       (ews-stop server))
+     "curl" "-s" (format "localhost:%d" ews-test-port))))
+
 (ert-deftest ews/keyword-style-handler ()
   "Ensure that a simple keyword-style handler matches correctly."
   (should t)                            ; should match one



reply via email to

[Prev in Thread] Current Thread [Next in Thread]