aboutsummaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
Diffstat (limited to 'test/data')
-rw-r--r--test/data/emacs-module/mod-test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c
index 437faaee2a0..ed289d7a863 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -201,7 +201,19 @@ Fmod_test_globref_free (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
201 return env->intern (env, "ok"); 201 return env->intern (env, "ok");
202} 202}
203 203
204/* Treat a local reference as global and free it. Module assertions
205 should detect this case even if a global reference representing the
206 same object also exists. */
204 207
208static emacs_value
209Fmod_test_globref_invalid_free (emacs_env *env, ptrdiff_t nargs,
210 emacs_value *args, void *data)
211{
212 emacs_value local = env->make_integer (env, 9876);
213 env->make_global_ref (env, local);
214 env->free_global_ref (env, local); /* Not allowed. */
215 return env->intern (env, "nil");
216}
205 217
206/* Return a copy of the argument string where every 'a' is replaced 218/* Return a copy of the argument string where every 'a' is replaced
207 with 'b'. */ 219 with 'b'. */
@@ -694,6 +706,8 @@ emacs_module_init (struct emacs_runtime *ert)
694 1, 1, NULL, NULL); 706 1, 1, NULL, NULL);
695 DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL); 707 DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL);
696 DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL); 708 DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL);
709 DEFUN ("mod-test-globref-invalid-free", Fmod_test_globref_invalid_free, 0, 0,
710 NULL, NULL);
697 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); 711 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL);
698 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); 712 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL);
699 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); 713 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL);