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 f6c1c7cf3d2..986c20ae8f9 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -191,7 +191,19 @@ Fmod_test_globref_free (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
191 return env->intern (env, "ok"); 191 return env->intern (env, "ok");
192} 192}
193 193
194/* Treat a local reference as global and free it. Module assertions
195 should detect this case even if a global reference representing the
196 same object also exists. */
194 197
198static emacs_value
199Fmod_test_globref_invalid_free (emacs_env *env, ptrdiff_t nargs,
200 emacs_value *args, void *data)
201{
202 emacs_value local = env->make_integer (env, 9876);
203 env->make_global_ref (env, local);
204 env->free_global_ref (env, local); /* Not allowed. */
205 return env->intern (env, "nil");
206}
195 207
196/* Return a copy of the argument string where every 'a' is replaced 208/* Return a copy of the argument string where every 'a' is replaced
197 with 'b'. */ 209 with 'b'. */
@@ -569,6 +581,8 @@ emacs_module_init (struct emacs_runtime *ert)
569 1, 1, NULL, NULL); 581 1, 1, NULL, NULL);
570 DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL); 582 DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL);
571 DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL); 583 DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL);
584 DEFUN ("mod-test-globref-invalid-free", Fmod_test_globref_invalid_free, 0, 0,
585 NULL, NULL);
572 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); 586 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL);
573 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); 587 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL);
574 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); 588 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL);