diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/emacs-module/mod-test.c | 11 | ||||
-rw-r--r-- | test/src/emacs-module-tests.el | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index da298d4e398..258a679b207 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -268,6 +268,16 @@ Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[], } +/* Return a unibyte string. */ +static emacs_value +Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + const char *string = "foo\x00zot"; + return env->make_unibyte_string (env, string, 7); +} + + /* Embedded pointers in lisp objects. */ /* C struct (pointer to) that will be embedded. */ @@ -750,6 +760,7 @@ emacs_module_init (struct emacs_runtime *ert) DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, NULL); DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); + DEFUN ("mod-test-return-unibyte", Fmod_test_return_unibyte, 0, 0, NULL, NULL); DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 1eebb418cf3..621229c62aa 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -500,4 +500,10 @@ See Bug#36226." (should (eq (mod-test-identity 123) 123)) (should-not (call-interactively #'mod-test-identity))) +(ert-deftest module/unibyte () + (let ((result (mod-test-return-unibyte))) + (should (stringp result)) + (should (not (multibyte-string-p (mod-test-return-unibyte)))) + (should (equal result "foo\x00zot")))) + ;;; emacs-module-tests.el ends here |