diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2017-09-27 23:16:54 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2017-09-27 23:16:54 +0200 |
commit | d72716ce16e8326f14ff7ae9ca41af5315e94ae4 (patch) | |
tree | e208805a5558748bd010dda915a126e6f043308b /tests/environment.scm | |
parent | a0b580448c4b24830ea37190eda53aa84b36cd60 (diff) | |
parent | ba294d6a3ba4d086bc9571d62c705ab6eab200e3 (diff) | |
download | mcron-d72716ce16e8326f14ff7ae9ca41af5315e94ae4.tar.gz mcron-d72716ce16e8326f14ff7ae9ca41af5315e94ae4.tar.bz2 mcron-d72716ce16e8326f14ff7ae9ca41af5315e94ae4.zip |
Merge branch 'devel'
Diffstat (limited to 'tests/environment.scm')
-rw-r--r-- | tests/environment.scm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/environment.scm b/tests/environment.scm new file mode 100644 index 0000000..1bc34a6 --- /dev/null +++ b/tests/environment.scm @@ -0,0 +1,39 @@ +;;;; environment.scm -- tests for (mcron environment) module +;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; GNU Mcron is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>. + +(use-modules (srfi srfi-64) + (mcron environment)) + +(test-begin "environment") + +(test-assert "modifiy-environment: basic" + (begin + (modify-environment '(("FOO" . "bar")) (getpw)) + (equal? (getenv "FOO") "bar"))) + +(test-assert "modifiy-environment: user & logname" + ;; Check that USER and LOGNAME environment variables can't be changed. + (let* ((user-entry (pk (getpw))) + (user-name (passwd:name user-entry))) + (modify-environment '(("USER" . "alice")) user-entry) + (modify-environment '(("LOGNAME" . "bob")) user-entry) + (equal? user-name + (pk (getenv "USER")) + (pk (getenv "LOGNAME"))))) + +(test-end) |