Fix a problem with Tramp when the temporary dir isn't C:/Temp on w32
[emacs.git] / test / src / callproc-tests.el
blob46541aba78c2fc2c106dc35d7eda11a80110f54c
1 ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*-
3 ;; Copyright (C) 2016 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 ;;; Code:
22 (require 'ert)
23 (eval-when-compile (require 'cl-lib))
25 (ert-deftest initial-environment-preserved ()
26 "Check that `initial-environment' is not modified by Emacs (Bug #10980)."
27 (skip-unless (eq system-type 'windows-nt))
28 (cl-destructuring-bind (initial-shell shell)
29 (with-temp-buffer
30 (let ((process-environment (cons "SHELL" process-environment)))
31 (call-process (expand-file-name invocation-name invocation-directory)
32 nil t nil
33 "--batch" "-Q" "--eval"
34 (prin1-to-string
35 '(progn (prin1 (getenv-internal "SHELL" initial-environment))
36 (prin1 (getenv-internal "SHELL"))))))
37 (split-string-and-unquote (buffer-string)))
38 (should (equal initial-shell "nil"))
39 (should-not (equal initial-shell shell))))