diff options
| author | Philipp Stephani | 2016-04-21 14:51:30 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-21 19:29:40 -0700 |
| commit | e7cb38edc946ff60c1c878b30b068376d6ef56d2 (patch) | |
| tree | 8fc810e91650a328dd6f6d95dd2a5f1f52b86c4a /test/src | |
| parent | 753c875714f708c0257a2d352635c5616be66fdc (diff) | |
| download | emacs-e7cb38edc946ff60c1c878b30b068376d6ef56d2.tar.gz emacs-e7cb38edc946ff60c1c878b30b068376d6ef56d2.zip | |
Use 'ucs-names' for character name escapes
* lread.c (invalid_character_name, check_scalar_value)
(parse_code_after_prefix, character_name_to_code): New helper
functions that use 'ucs-names' and parsing for CJK ideographs.
(read_escape): Use helper functions.
(syms_of_lread): New symbol 'ucs-names'.
* test/src/lread-tests.el: New tests; fix a couple of bugs in
existing tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/lread-tests.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 1f873340c56..ff5d0f655f3 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -40,10 +40,17 @@ | |||
| 40 | (should-error (read "?\\N{DOES NOT EXIST}")) :type 'invalid-read-syntax) | 40 | (should-error (read "?\\N{DOES NOT EXIST}")) :type 'invalid-read-syntax) |
| 41 | 41 | ||
| 42 | (ert-deftest lread-char-non-ascii-name () | 42 | (ert-deftest lread-char-non-ascii-name () |
| 43 | (should-error (read "?\\N{LATIN CAPITAL LETTER Ø}")) 'invalid-read-syntax) | 43 | (should-error (read "?\\N{LATIN CAPITAL LETTER Ø}") |
| 44 | :type 'invalid-read-syntax)) | ||
| 44 | 45 | ||
| 45 | (ert-deftest lread-char-empty-name () | 46 | (ert-deftest lread-char-empty-name () |
| 46 | (should-error (read "?\\N{}")) 'invalid-read-syntax) | 47 | (should-error (read "?\\N{}") :type 'invalid-read-syntax)) |
| 48 | |||
| 49 | (ert-deftest lread-char-cjk-name () | ||
| 50 | (should (equal ?\N{CJK IDEOGRAPH-2B734} #x2B734))) | ||
| 51 | |||
| 52 | (ert-deftest lread-char-invalid-cjk-name () | ||
| 53 | (should-error (read "?\\N{CJK IDEOGRAPH-2B735}") :type 'invalid-read-syntax)) | ||
| 47 | 54 | ||
| 48 | (ert-deftest lread-string-char-number () | 55 | (ert-deftest lread-string-char-number () |
| 49 | (should (equal "a\N{U+A817}b" "a\uA817b"))) | 56 | (should (equal "a\N{U+A817}b" "a\uA817b"))) |