Mercurial > hg > xemacs-beta
annotate tests/automated/lisp-reader-tests.el @ 5471:00e79bbbe48f
Merge with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Mon, 14 Feb 2011 22:43:46 +0100 |
parents | b9167d522a9a |
children | 159face738c3 |
rev | line source |
---|---|
3543 | 1 ;; Copyright (C) 2005 Martin Kuehl. |
2 | |
3 ;; Author: Martin Kuehl <martin.kuehl@gmail.com> | |
4 ;; Maintainer: Martin Kuehl <martin.kuehl@gmail.com> | |
5 ;; Created: 2005 | |
6 ;; Keywords: tests | |
7 | |
5290
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3543
diff
changeset
|
8 ;; This file is part of XEmacs. |
3543 | 9 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
10 ;; 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:
3543
diff
changeset
|
11 ;; 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:
3543
diff
changeset
|
12 ;; 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:
3543
diff
changeset
|
13 ;; option) any later version. |
3543 | 14 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
15 ;; 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:
3543
diff
changeset
|
16 ;; 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:
3543
diff
changeset
|
17 ;; 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:
3543
diff
changeset
|
18 ;; for more details. |
3543 | 19 |
20 ;; 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:
3543
diff
changeset
|
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
3543 | 22 |
23 ;;; Synched up with: Not in FSF. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; Test the lisp reader. | |
28 ;; See test-harness.el for instructions on how to run these tests. | |
29 | |
30 ;;; Raw Strings | |
31 ;;; =========== | |
32 | |
33 ;; Equality to "traditional" strings | |
34 ;; --------------------------------- | |
35 (dolist (strings '((#r"xyz" "xyz") ; no backslashes | |
36 (#r"\xyz" "\\xyz") ; backslash at start | |
37 (#r"\\xyz" "\\\\xyz") ; backslashes at start | |
38 (#r"\nxyz" "\\nxyz") ; escape seq. at start | |
39 (#r"\"xyz" "\\\"xyz") ; quote at start | |
40 (#r"xy\z" "xy\\z") ; backslash in middle | |
41 (#r"xy\\z" "xy\\\\z") ; backslashes in middle | |
42 (#r"xy\nz" "xy\\nz") ; escape seq. in middle | |
43 (#r"xy\"z" "xy\\\"z") ; quote in middle | |
44 ;;(#r"xyz\" "xyz\\") ; backslash at end: error | |
45 (#r"xyz\\" "xyz\\\\") ; backslashes at end | |
46 (#r"xyz\n" "xyz\\n") ; escape seq. at end | |
47 (#r"xyz\"" "xyz\\\"") ; quote at end | |
48 (#ru"\u00ABxyz" "\u00ABxyz") ; one Unicode escape | |
49 (#rU"\U000000ABxyz" "\U000000ABxyz") ; another Unicode escape | |
50 (#rU"xyz\u00AB" "xyz\u00AB") ; one Unicode escape | |
51 )) | |
52 (Assert (apply #'string= strings))) | |
53 | |
54 ;; Odd number of backslashes at the end | |
55 ;; ------------------------------------ | |
56 (dolist (string '("#r\"xyz\\\"" ; `#r"abc\"': escaped delimiter | |
57 "#r\"xyz\\\\\\\"" ; `#r"abc\\\"': escaped delimiter | |
58 )) | |
59 (with-temp-buffer | |
60 (insert string) | |
61 (Check-Error end-of-file (eval-buffer)))) | |
62 | |
63 ;; Alternate string/regex delimiters | |
64 ;; --------------------------------- | |
65 (dolist (string '("#r/xyz/" ; Perl syntax | |
66 "#r:ix/xyz/" ; Extended Perl syntax | |
67 "#r|xyz|" ; TeX syntax | |
68 "#r[xyz]" ; (uncommon) Perl syntax | |
69 "#r<xyz>" ; Perl6 syntax? | |
70 "#r(xyz)" ; arbitrary santax | |
71 "#r{xyz}" ; arbitrary santax | |
72 "#r,xyz," ; arbitrary santax | |
73 "#r!xyz!" ; arbitrary santax | |
74 )) | |
75 (with-temp-buffer | |
76 (insert string) | |
77 (Check-Error-Message invalid-read-syntax "unrecognized raw string" | |
78 (eval-buffer)))) |