1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-02 21:52:04 -08:00
emacs/test/src
Philipp Stephani 52e3ac6303 Document and enforce some properties for strings created by modules.
When creating multibyte or unibyte strings, we should guarantee the
following invariants:

- When creating empty strings, a NULL data pointer should be allowed.
  This often arises in practice if the string length isn't known in
  advance, and we don't want to unnecessarily trigger undefined
  behavior.  Since functions like memcpy might not accept NULL
  pointers, use the canonical empty string objects in this case.

- Nonzero strings should be guaranteed to be unique and mutable.
  These are the same guarantees expected from Lisp functions such as
  'make-string' or 'unibyte-string'.  On the other hand, empty strings
  might not be unique.

* src/emacs-module.c (module_make_string)
(module_make_unibyte_string): Correctly handle empty strings.

* test/src/emacs-module-resources/mod-test.c (Fmod_test_make_string):
New test function.
(emacs_module_init): Expose it.

* test/src/emacs-module-tests.el (mod-test-make-string/empty)
(mod-test-make-string/nonempty): New unit tests.

* doc/lispref/internals.texi (Module Values): Document properties and
corner cases for strings.
2020-12-12 23:28:22 +01:00
..
emacs-module-resources Document and enforce some properties for strings created by modules. 2020-12-12 23:28:22 +01:00
lread-resources Move some test data to follow our conventions 2020-10-23 16:29:46 +02:00
regex-resources ; Fix more typos 2020-10-03 12:53:51 +02:00
syntax-resources Enhance syntax-tests.el to test nestable comments (Lisp style) 2020-11-17 16:51:49 +00:00
alloc-tests.el Fix crash when sending Gnus message (Bug#39207) 2020-01-22 23:44:34 -08:00
buffer-tests.el Merge from origin/emacs-27 2020-06-07 09:03:59 -07:00
callint-tests.el Adapt some tests for Emacs's excitingly variable quoting format 2020-09-12 11:57:42 -07:00
callproc-tests.el Fix error in 'call-process-region' when START is nil (Bug#40576) 2020-04-12 19:04:11 +02:00
casefiddle-tests.el Fupcase no longer maps ?ß to itself (bug#11309) 2020-12-10 11:02:27 +01:00
charset-tests.el ; Fix license statements. 2020-08-27 02:53:25 +02:00
chartab-tests.el ; Fix license statements. 2020-08-27 02:53:25 +02:00
cmds-tests.el ; Fix license statements. 2020-08-27 02:53:25 +02:00
coding-tests.el Merge from origin/emacs-27 2020-10-02 09:38:24 -07:00
data-tests.el Prefer setq-local in tests 2020-12-08 08:57:22 +01:00
decompress-tests.el Use lexical-binding in most src tests 2020-04-24 18:25:13 +02:00
editfns-tests.el Use lexical-binding in more tests 2020-08-29 22:41:51 +02:00
emacs-module-tests.el Document and enforce some properties for strings created by modules. 2020-12-12 23:28:22 +01:00
eval-tests.el Add new variable to selectively suppress backtraces in batch mode. 2020-12-07 11:59:06 +01:00
fileio-tests.el Fix 'expand-file-name' for remote files 2020-09-03 20:16:33 +03:00
floatfns-tests.el Use lexical-binding in most src tests 2020-04-24 18:25:13 +02:00
fns-tests.el Fix object-interval tests 2020-12-11 15:21:44 +01:00
font-tests.el Use lexical-binding in most src tests 2020-04-24 18:25:13 +02:00
indent-tests.el Fix 'move-to-column' when invisible text follows a TAB 2020-09-30 17:33:58 +03:00
inotify-tests.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
json-tests.el Fix undefined behavior in json.c (Bug#42113) 2020-06-29 12:32:56 +02:00
keyboard-tests.el Give Lisp control on the lossage size 2020-09-17 16:32:18 +02:00
keymap-tests.el Say which command shadows a key binding 2020-11-22 02:48:53 +01:00
lcms-tests.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
lread-tests.el Move some test data to follow our conventions 2020-10-23 16:29:46 +02:00
marker-tests.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
minibuf-tests.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
print-tests.el Reduce integer-output-format to print-integers-as-characters 2020-11-06 13:55:32 +01:00
process-tests.el ; Fix license statements. 2020-08-27 02:53:25 +02:00
regex-emacs-tests.el Recognise ß properly as a lower-case letter (bug#11309) 2020-12-09 15:29:48 +01:00
syntax-tests.el Enhance syntax-tests.el to test nestable comments (Lisp style) 2020-11-17 16:51:49 +00:00
textprop-tests.el Use lexical-binding in most src tests 2020-04-24 18:25:13 +02:00
thread-tests.el Use lexical-binding in most src tests 2020-04-24 18:25:13 +02:00
timefns-tests.el ; Fix license statements. 2020-08-27 02:53:25 +02:00
undo-tests.el ; Fix license statement in several files 2020-10-28 03:41:55 +01:00
xdisp-tests.el ; Silence byte-compiler warning in xdisp-tests.el 2020-11-05 15:44:17 +01:00
xfaces-tests.el Minor improvements as followup to recent RGB string-parsing change 2020-06-22 18:32:01 +03:00
xml-tests.el Repurpose libxml test for obsolete argument 2020-09-26 11:48:09 +02:00