diff options
| author | Mattias EngdegÄrd | 2025-07-25 21:53:37 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2025-07-25 21:54:59 +0200 |
| commit | 33161e51e539eadeb11282c06df73a5d76afdff2 (patch) | |
| tree | 8242f0dd59ef06486174d3600417c945062da6a6 /test | |
| parent | 50ffb29d0bbb92a7c6569c83d2e3e4868c4e867b (diff) | |
| download | emacs-33161e51e539eadeb11282c06df73a5d76afdff2.tar.gz emacs-33161e51e539eadeb11282c06df73a5d76afdff2.zip | |
Check for end-of-file when reading character escapes (bug#79097)
* src/lread.c (read_char_escape): Add check.
* test/src/lread-tests.el (lread-char-escape-eof): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/lread-tests.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 02e3efcf06c..421c0c0ed4a 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -358,6 +358,37 @@ literals (Bug#20852)." | |||
| 358 | (should-error (read-from-string "?\\\n x")) | 358 | (should-error (read-from-string "?\\\n x")) |
| 359 | (should (equal (read-from-string "\"a\\\nb\"") '("ab" . 6)))) | 359 | (should (equal (read-from-string "\"a\\\nb\"") '("ab" . 6)))) |
| 360 | 360 | ||
| 361 | (ert-deftest lread-char-escape-eof () | ||
| 362 | ;; Check that unfinished char escapes signal an error. | ||
| 363 | (should-error (read "?\\")) | ||
| 364 | |||
| 365 | (should-error (read "?\\^")) | ||
| 366 | (should-error (read "?\\C")) | ||
| 367 | (should-error (read "?\\M")) | ||
| 368 | (should-error (read "?\\S")) | ||
| 369 | (should-error (read "?\\H")) | ||
| 370 | (should-error (read "?\\A")) | ||
| 371 | |||
| 372 | (should-error (read "?\\C-")) | ||
| 373 | (should-error (read "?\\M-")) | ||
| 374 | (should-error (read "?\\S-")) | ||
| 375 | (should-error (read "?\\H-")) | ||
| 376 | (should-error (read "?\\A-")) | ||
| 377 | (should-error (read "?\\s-")) | ||
| 378 | |||
| 379 | (should-error (read "?\\C-\\")) | ||
| 380 | (should-error (read "?\\C-\\M")) | ||
| 381 | (should-error (read "?\\C-\\M-")) | ||
| 382 | |||
| 383 | (should-error (read "?\\x")) | ||
| 384 | (should-error (read "?\\u")) | ||
| 385 | (should-error (read "?\\u234")) | ||
| 386 | (should-error (read "?\\U")) | ||
| 387 | (should-error (read "?\\U0010010")) | ||
| 388 | (should-error (read "?\\N")) | ||
| 389 | (should-error (read "?\\N{")) | ||
| 390 | (should-error (read "?\\N{SPACE"))) | ||
| 391 | |||
| 361 | (ert-deftest lread-force-load-doc-strings () | 392 | (ert-deftest lread-force-load-doc-strings () |
| 362 | ;; Verify that lazy doc strings are loaded lazily by default, | 393 | ;; Verify that lazy doc strings are loaded lazily by default, |
| 363 | ;; but eagerly with `force-load-doc-strings' set. | 394 | ;; but eagerly with `force-load-doc-strings' set. |