Mercurial > hg > xemacs-beta
comparison tests/automated/lisp-tests.el @ 4608:1e3cf11fa27d
Make #$ truly read-only for Lisp; check this in the test suite.
lisp/ChangeLog addition:
2009-02-10 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el :
Check that #$ is not modifiable from Lisp, and that load-file-name
is modifiable from Lisp.
src/ChangeLog addition:
2009-02-10 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (Fload_internal):
Make load-file-name-internal readonly for Lisp code; make
load-file-name a modifiable copy.
(init_lread):
Initialised Vload_file_name_internal, Vload_file_name to nil on
each post-dump start.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 10 Feb 2009 16:07:31 +0000 |
parents | 00ed9903a988 |
children | b5e1d4f6b66f |
comparison
equal
deleted
inserted
replaced
4607:517f6887fbc0 | 4608:1e3cf11fa27d |
---|---|
1332 (char-table-with-symbol #s(char-table data (?\x00 text)))) | 1332 (char-table-with-symbol #s(char-table data (?\x00 text)))) |
1333 (Assert (not (string-equal (prin1-to-string char-table-with-string) | 1333 (Assert (not (string-equal (prin1-to-string char-table-with-string) |
1334 (prin1-to-string char-table-with-symbol))) | 1334 (prin1-to-string char-table-with-symbol))) |
1335 "Check that char table elements are quoted correctly when printing")) | 1335 "Check that char table elements are quoted correctly when printing")) |
1336 | 1336 |
1337 | |
1338 (let ((test-file-name | |
1339 (make-temp-file (expand-file-name "sR4KDwU" (temp-directory)) | |
1340 nil ".el"))) | |
1341 (find-file test-file-name) | |
1342 (erase-buffer) | |
1343 (insert | |
1344 "\ | |
1345 ;; Lisp should not be able to modify #$, which is | |
1346 ;; Vload_file_name_internal of lread.c. | |
1347 (Check-Error setting-constant (aset #$ 0 ?\\ )) | |
1348 | |
1349 ;; But modifying load-file-name should work: | |
1350 (let ((new-char ?\\ ) | |
1351 old-char) | |
1352 (setq old-char (aref load-file-name 0)) | |
1353 (if (= new-char old-char) | |
1354 (setq new-char ?/)) | |
1355 (aset load-file-name 0 new-char) | |
1356 (Assert (= new-char (aref load-file-name 0)) | |
1357 \"Check that we can modify the string value of load-file-name\")) | |
1358 | |
1359 (let* ((new-load-file-name \"hi there\") | |
1360 (load-file-name new-load-file-name)) | |
1361 (Assert (eq new-load-file-name load-file-name) | |
1362 \"Checking that we can bind load-file-name successfully.\")) | |
1363 | |
1364 ") | |
1365 (write-region (point-min) (point-max) test-file-name nil 'quiet) | |
1366 (set-buffer-modified-p nil) | |
1367 (kill-buffer nil) | |
1368 (load test-file-name nil t nil) | |
1369 (delete-file test-file-name)) | |
1370 | |
1371 | |
1372 |