-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
inheritenv-tests.el
38 lines (31 loc) · 901 Bytes
/
inheritenv-tests.el
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
35
36
37
38
;;; inheritenv-test.el --- Tests for inheritenv.el -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(require 'ert)
(require 'inheritenv)
(defun inheritenv-test--get-vars-in-temp-buffer (&rest vars)
"Return a list of the values of the named environment VARS."
(with-temp-buffer
(mapcar 'getenv vars)))
(inheritenv-add-advice 'inheritenv-test--get-vars-in-temp-buffer)
(ert-deftest inheritenv-test-propagation ()
(with-temp-buffer
(setq-local process-environment '("FOO=BAR"))
;; Default behaviour
(should
(equal
nil
(with-temp-buffer
(getenv "FOO"))))
;; With inheritenv
(should
(equal
"BAR"
(inheritenv (with-temp-buffer
(getenv "FOO")))))
(should
(equal
'("BAR")
(inheritenv-test--get-vars-in-temp-buffer "FOO")))))
(provide 'inheritenv-test)
;;; inheritenv-test.el ends here