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[], | |||
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | 270 | ||
| 271 | /* Return a unibyte string. */ | ||
| 272 | static emacs_value | ||
| 273 | Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t nargs, emacs_value args[], | ||
| 274 | void *data) | ||
| 275 | { | ||
| 276 | const char *string = "foo\x00zot"; | ||
| 277 | return env->make_unibyte_string (env, string, 7); | ||
| 278 | } | ||
| 279 | |||
| 280 | |||
| 271 | /* Embedded pointers in lisp objects. */ | 281 | /* Embedded pointers in lisp objects. */ |
| 272 | 282 | ||
| 273 | /* C struct (pointer to) that will be embedded. */ | 283 | /* C struct (pointer to) that will be embedded. */ |
| @@ -750,6 +760,7 @@ emacs_module_init (struct emacs_runtime *ert) | |||
| 750 | DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, | 760 | DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, |
| 751 | NULL); | 761 | NULL); |
| 752 | DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); | 762 | DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); |
| 763 | DEFUN ("mod-test-return-unibyte", Fmod_test_return_unibyte, 0, 0, NULL, NULL); | ||
| 753 | DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); | 764 | DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); |
| 754 | DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); | 765 | DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); |
| 755 | DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); | 766 | 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." | |||
| 500 | (should (eq (mod-test-identity 123) 123)) | 500 | (should (eq (mod-test-identity 123) 123)) |
| 501 | (should-not (call-interactively #'mod-test-identity))) | 501 | (should-not (call-interactively #'mod-test-identity))) |
| 502 | 502 | ||
| 503 | (ert-deftest module/unibyte () | ||
| 504 | (let ((result (mod-test-return-unibyte))) | ||
| 505 | (should (stringp result)) | ||
| 506 | (should (not (multibyte-string-p (mod-test-return-unibyte)))) | ||
| 507 | (should (equal result "foo\x00zot")))) | ||
| 508 | |||
| 503 | ;;; emacs-module-tests.el ends here | 509 | ;;; emacs-module-tests.el ends here |