Mercurial > hg > xemacs-beta
annotate tests/automated/file-tests.el @ 5916:1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
lisp/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* code-files.el (load):
Revise this to respect load-ignore-out-of-date-elc-files, rather
than leaving that to #'load-internal. Avoids a corner case where
the source and the compiled file have different, incompatible
encodings.
Move the call to #'substitute-in-file-name here.
No longer check for a zero-length filename, since #'load-internal
no longer chokes on same and errors correctly.
src/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (Fload_internal):
Delegate calling the handler and #'substitute-in-file-name to #'load.
Error correctly with a zero-length file name, instead of giving a
bus error on my machine.
Delegate the check for out-of-date ELC files to #'load,
avoiding a bug where the encoding of the ELC file and the source
file differed.
* lread.c (PRINT_LOADING_MESSAGE_1):
This is simplified, now we no longer have to talk about
out-of-date ELC files.
tests/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* automated/file-tests.el:
Gross sanity check for #'load and #'load-internal with a
zero-length FILE, something that crashed until today.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 03 Jun 2015 20:13:07 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
1 ;;; file-tests.el --- test support for filesystem primitives |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
2 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 2010 Ben Wing. |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
4 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
5 ;; Author: Ben Wing <ben@xemacs.org> |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
6 ;; Maintainer: Ben Wing <ben@xemacs.org> |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
7 ;; Created: 2010 January 25 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
8 ;; Keywords: files, filenames, file names |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
9 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
10 ;; This file is part of XEmacs. |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
11 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
12 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
13 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
14 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
15 ;; option) any later version. |
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
16 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
20 ;; for more details. |
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
21 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
24 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
25 ;;; Synched up with: Not in FSF. |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
26 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
27 ;;; Commentary: |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
28 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
29 ;; Test file-system support. Opening files, file names, etc. |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
30 ;; See test-harness.el for instructions on how to run these tests. |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
31 |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
32 ;; Test that `file-truename' is idempotent (same value when called multiple |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
33 ;; times). Under Cygwin 1.7 as of 1-24-10, not true! |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
34 (loop for file in (list (temp-directory) |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
35 (file-name-as-directory (temp-directory)) |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
36 "/" |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
37 (file-name-as-directory "/") |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
38 (make-temp-name "foo") |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
39 ) |
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
40 do |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4948
diff
changeset
|
41 (Assert (equal (file-truename (file-truename file)) (file-truename file)))) |
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
42 |
5916
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
43 ;; |
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
44 ;; Gross sanity check with #'load and a zero-length filename: |
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
45 (Check-Error file-error (load "")) |
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
46 (Assert (eq nil (load "" t))) |
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
47 (Check-Error file-error (load-internal "")) |
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
48 (Assert (eq nil (load-internal "" t))) |
4948
8b230c53075b
fix some tests in `make check', also add our own file-tests
Ben Wing <ben@xemacs.org>
parents:
diff
changeset
|
49 |
5916
1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
50 ;;; end of file-tests.el |