1 ;;; emacs-web-server-test.el --- Test the Emacs Web Server
3 ;; Copyright (C) 2013 Eric Schulte <schulte.eric@gmail.com>
5 ;; Author: Eric Schulte <schulte.eric@gmail.com>
6 ;; License: GPLV3 (see the COPYING file in this directory)
8 ;;; TODO: fill in these tests, and then write more
11 (require 'emacs-web-server)
13 (eval-when-compile (require 'cl))
16 (defun ews-test-run-asynch (continuation program &rest program-args)
17 (let* ((buffer (generate-new-buffer "*ews-test-run-asynch*"))
18 (proc (apply #'start-process "ews-test" buffer program program-args)))
19 (set-process-sentinel proc
20 (lexical-let ((cont continuation)
23 (when (memq (process-status proc) '(exit signal))
24 (funcall cont (prog1 (with-current-buffer buf
26 (kill-buffer buf)))))))))
28 (ert-deftest ews/keyword-style-handler ()
29 "Ensure that a simple keyword-style handler matches correctly."
30 (should t) ; should match one
31 (should-not nil) ; should not match another
34 (ert-deftest ews/function-style-handler ()
35 "Ensure that a function-style handler matches correctly."
36 (should t) ; should match one
37 (should-not nil) ; should not match another
40 (ert-deftest ews/removed-from-ews-servers-after-stop ()
43 (ert-deftest ews/parse-many-headers ()
44 "Test that a number of headers parse successfully."
47 (ert-deftest ews/parse-post-data ()
50 User-Agent: curl/7.33.0
55 Content-Type: multipart/form-data; boundary=----------------f1270d0deb77af03
57 ------------------f1270d0deb77af03
58 Content-Disposition: form-data; name=\"date\"
60 Wed Dec 18 00:55:39 MST 2013
62 ------------------f1270d0deb77af03
63 Content-Disposition: form-data; name=\"name\"
66 ------------------f1270d0deb77af03--
68 (should 'properly-parse-post-data)))