1 ;; Copyright (C) 2005 Martin Kuehl.
3 ;; Author: Martin Kuehl <martin.kuehl@gmail.com>
4 ;; Maintainer: Martin Kuehl <martin.kuehl@gmail.com>
8 ;; This file is NOT part of SXEmacs.
10 ;; SXEmacs is free software: you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by the
12 ;; Free Software Foundation, either version 3 of the License, or (at your
13 ;; option) any later version.
15 ;; SXEmacs is distributed in the hope that it will be
16 ;; useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Synched up with: Not in FSF.
27 ;; Test the lisp reader.
28 ;; See test-harness.el for instructions on how to run these tests.
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
49 (Assert (apply #'string= strings)))
51 ;; Odd number of backslashes at the end
52 ;; ------------------------------------
53 (dolist (string '("#r\"xyz\\\"" ; `#r"abc\"': escaped delimiter
54 "#r\"xyz\\\\\\\"" ; `#r"abc\\\"': escaped delimiter
58 (Check-Error end-of-file (eval-buffer))))
60 ;; Alternate string/regex delimiters
61 ;; ---------------------------------
62 (dolist (string '("#r/xyz/" ; Perl syntax
63 "#r:ix/xyz/" ; Extended Perl syntax
64 "#r|xyz|" ; TeX syntax
65 "#r[xyz]" ; (uncommon) Perl syntax
66 "#r<xyz>" ; Perl6 syntax?
67 "#r(xyz)" ; arbitrary santax
68 "#r{xyz}" ; arbitrary santax
69 "#r,xyz," ; arbitrary santax
70 "#r!xyz!" ; arbitrary santax
74 (Check-Error-Message invalid-read-syntax "unrecognized raw string"