aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/lread-tests.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-08-06 13:38:12 +0200
committerMattias EngdegÄrd2022-08-07 10:25:03 +0200
commitc46863d9bb8493d0d15030df863d78b8f1738b2e (patch)
treef395533ce64405e1e028a25261b844ec4b88b232 /test/src/lread-tests.el
parent6fd4ab250b690736e706245106f396cc93f3f5f0 (diff)
downloademacs-c46863d9bb8493d0d15030df863d78b8f1738b2e.tar.gz
emacs-c46863d9bb8493d0d15030df863d78b8f1738b2e.zip
Make force-load-doc-strings work again
When load-force-doc-strings is true, read (#$ . POS) as the (unibyte) string referred to. This feature was lost by mistake in the recent nonrecursive reader rewrite. Noticed by Stefan Monnier. * src/lread.c (get_lazy_string): New function (code mostly recycled from an old version). (read0): Detect (#$ . FIXNUM) and retrieve the string if appropriate. * test/src/lread-resources/lazydoc.el: * test/src/lread-tests.el (lread-force-load-doc-strings): New test.
Diffstat (limited to 'test/src/lread-tests.el')
-rw-r--r--test/src/lread-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index f190f14781e..2f25de4cc39 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -322,4 +322,21 @@ literals (Bug#20852)."
322 (should-error (read-from-string "?\\\n x")) 322 (should-error (read-from-string "?\\\n x"))
323 (should (equal (read-from-string "\"a\\\nb\"") '("ab" . 6)))) 323 (should (equal (read-from-string "\"a\\\nb\"") '("ab" . 6))))
324 324
325(ert-deftest lread-force-load-doc-strings ()
326 ;; Verify that lazy doc strings are loaded lazily by default,
327 ;; but eagerly with `force-load-doc-strings' set.
328 (let ((file (expand-file-name "lazydoc.el" (ert-resource-directory))))
329 (fmakunbound 'lazydoc-fun)
330 (load file)
331 (let ((f (symbol-function 'lazydoc-fun)))
332 (should (byte-code-function-p f))
333 (should (equal (aref f 4) (cons file 87))))
334
335 (fmakunbound 'lazydoc-fun)
336 (let ((load-force-doc-strings t))
337 (load file)
338 (let ((f (symbol-function 'lazydoc-fun)))
339 (should (byte-code-function-p f))
340 (should (equal (aref f 4) "My little\ndoc string\nhere"))))))
341
325;;; lread-tests.el ends here 342;;; lread-tests.el ends here