* test/automated/files.el (files-test-disable-local-variables): New test.
[emacs.git] / test / automated / files.el
blobe43d8c32f8508cb0547ebc3671dd05f7611dc665
1 ;;; files.el --- tests for file handling.
3 ;; Copyright (C) 2012 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)
24 (defvar files-test-var1 nil)
26 (defun files-test-fun1 ()
27 (setq files-test-var1 t))
29 (ert-deftest files-test-bug12155 ()
30 "Test for http://debbugs.gnu.org/12155 ."
31 (with-temp-buffer
32 (insert "text\n"
33 ";; Local Variables:\n"
34 ";; eval: (files-test-fun1)\n"
35 ";; End:\n")
36 (let ((enable-local-variables :safe)
37 (enable-local-eval 'maybe))
38 (hack-local-variables)
39 (should (eq files-test-var1 nil)))))
41 (ert-deftest files-test-disable-local-variables ()
42 "Test that setting enable-local-variables to nil works."
43 (with-temp-buffer
44 (insert "text\n"
45 ";; Local Variables:\n"
46 ";; files-test-var1: t\n"
47 ";; End:\n")
48 (let ((enable-local-variables nil))
49 (hack-local-variables)
50 (should (eq files-test-var1 nil)))))
52 ;;; files.el ends here