aboutsummaryrefslogtreecommitdiff
path: root/tests/test-httpd-config--defer.el
blob: 1a1fbbed49697c9c18bce2e7f0108b457d1e2556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;; test-httpd-config--defer.el --- Tests for httpd-config lazy loading -*- lexical-binding: t -*-

;;; Commentary:
;; Pins httpd-config's load-time behavior: merely loading the module must
;; not create the www directory (that belongs to the moment simple-httpd
;; actually loads) and must not pull in simple-httpd itself —
;; impatient-mode requires it on demand.

;;; Code:

(require 'ert)

(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))

;;; Boundary Cases

(ert-deftest test-httpd-config-load-creates-no-www-dir ()
  "Boundary: loading httpd-config does not create www/ in user-emacs-directory."
  (let* ((sandbox (make-temp-file "httpd-config-test-" t))
         (user-emacs-directory (file-name-as-directory sandbox)))
    (unwind-protect
        (progn
          (require 'httpd-config)
          (should-not (file-directory-p
                       (expand-file-name "www" user-emacs-directory))))
      (delete-directory sandbox t))))

(ert-deftest test-httpd-config-load-does-not-load-simple-httpd ()
  "Boundary: loading httpd-config leaves simple-httpd unloaded."
  (require 'httpd-config)
  (should-not (featurep 'simple-httpd)))

(provide 'test-httpd-config--defer)
;;; test-httpd-config--defer.el ends here