annotate tests/automated/files-tests.el @ 5793:cf0201de66df

Help buffer behaviour synced with GNU lisp/ChangeLog: 2014-04-19 Mats Lidell <matsl@xemacs.org> * help.el: Sync from GNU - Link to customize if applicable and display version info. Other changes: Remove use of button-2. return and button-1 use activate-function. Move between activate-function-extents with tab. tests/ChangeLog: 2014-04-19 Mats Lidell <matsl@xemacs.org> * automated/keymap-tests.el: Use help-activate-function-or-scroll-up.
author Mats Lidell <mats.lidell@cag.se>
date Fri, 25 Apr 2014 23:38:16 +0200
parents 182d01410b8d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5766
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
1 ;; Copyright (C) 2013 Free Software Foundation, Inc.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
2
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
3 ;; Author: Mats Lidell <matsl@xemacs.org>
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
4 ;; Maintainer:
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
5 ;; Created: 2013
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
6 ;; Keywords: tests
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
7
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
8 ;; This file is part of XEmacs.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
9
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
10 ;; XEmacs is free software: you can redistribute it and/or modify it
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by the
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
12 ;; Free Software Foundation, either version 3 of the License, or (at your
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
13 ;; option) any later version.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
14
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
18 ;; for more details.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
19
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
22
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
23 ;;; Synched up with: Not in FSF.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
24
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
25 ;;; Commentary:
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
26
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
27 ;; Test tag support.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
28 ;; See test-harness.el for instructions on how to run these tests.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
29
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
30 (require 'test-harness)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
31
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
32 ;; Require a newline on save
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
33 (let ((test-file-name (make-temp-file "files-tests"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
34 (require-final-newline t))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
35 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
36 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
37 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
38 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
39 (Assert (equal (buffer-string) "no newline\n"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
40 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
41 (delete-file test-file-name))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
42
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
43 ;; Don't require a newline on save
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
44 (let ((test-file-name (make-temp-file "files-tests"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
45 (require-final-newline nil))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
46 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
47 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
48 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
49 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
50 (Assert (equal (buffer-string) "no newline"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
51 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
52 (delete-file test-file-name))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
53
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
54 ;; Require a newline on visit (not on save)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
55 ;; Answer query when saving with both no and yes.
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
56 (let ((test-file-name (make-temp-file "files-tests"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
57 (require-final-newline nil))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
58 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
59 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
60 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
61 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
62 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
63 (let ((require-final-newline 'visit))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
64 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
65 (Assert (equal (buffer-string) "no newline\n"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
66
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
67 ;; Answer no
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
68 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
69 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
70 (flet ((y-or-n-p (prompt) nil))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
71 (Silence-Message (save-buffer 0)))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
72 (Assert (equal (buffer-string) "no newline"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
73
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
74 ;; Answer yes
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
75 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
76 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
77 (flet ((y-or-n-p (prompt) t))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
78 (Silence-Message (save-buffer 0)))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
79 (Assert (equal (buffer-string) "no newline\n")))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
80
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
81 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
82 (delete-file test-file-name))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
83
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
84 ;; Require a newline on visit and save
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
85 (let ((test-file-name (make-temp-file "files-tests"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
86 (require-final-newline nil))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
87 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
88 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
89 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
90 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
91 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
92 (let ((require-final-newline 'visit-save))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
93 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
94 (Assert (equal (buffer-string) "no newline\n"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
95 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
96 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
97 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
98 (Assert (equal (buffer-string) "no newline\n")))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
99 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
100 (delete-file test-file-name))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
101
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
102 ;; mode-require-final-newline is respected by text-mode
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
103 (let ((test-file-name (make-temp-file "files-tests"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
104 (require-final-newline nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
105 (mode-require-final-newline t))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
106 (Assert (equal require-final-newline nil))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
107 (find-file test-file-name)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
108 (erase-buffer)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
109 (text-mode)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
110 (Assert (equal require-final-newline t))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
111 (insert "no newline")
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
112 (Silence-Message (save-buffer 0))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
113 (Assert (equal (buffer-string) "no newline\n"))
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
114 (kill-buffer nil)
182d01410b8d Add mode-require-final-newline from GNU. Thanks GNU.
Mats Lidell <mats.lidell@cag.se>
parents:
diff changeset
115 (delete-file test-file-name))