summaryrefslogtreecommitdiff
path: root/test/data
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2020-07-29 08:39:28 -0700
committerGlenn Morris <rgm@gnu.org>2020-07-29 08:39:28 -0700
commit8f46e67ffdad7fd0887c9a0fc0a6a697c2cc4d50 (patch)
tree5fe3a872212efda8b105cd1d35840bc7e50b6824 /test/data
parent64a1b4245673aea1c9bce54226edcdeaf3064ca6 (diff)
parent1fc742b63ebfa548dd3ff6e99b530480e8c0b12c (diff)
downloademacs-8f46e67ffdad7fd0887c9a0fc0a6a697c2cc4d50.tar.gz
Merge from origin/emacs-27
1fc742b63e ; Update ChangeLog.3 4c7f6217da * etc/AUTHORS: Update. 24391f517a Update authors.el 56f958807c * etc/NEWS: Remove temporary markup. 73a2f51043 Add another test for global module references # Conflicts: # etc/AUTHORS # etc/NEWS
Diffstat (limited to 'test/data')
-rw-r--r--test/data/emacs-module/mod-test.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c
index ed289d7a863..f72b85a5d8e 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -215,6 +215,35 @@ Fmod_test_globref_invalid_free (emacs_env *env, ptrdiff_t nargs,
return env->intern (env, "nil");
}
+/* Allocate and free global references in a different order. */
+
+static emacs_value
+Fmod_test_globref_reordered (emacs_env *env, ptrdiff_t nargs,
+ emacs_value *args, void *data)
+{
+ emacs_value booleans[2] = {
+ env->intern (env, "nil"),
+ env->intern (env, "t"),
+ };
+ emacs_value local = env->intern (env, "foo");
+ emacs_value globals[4] = {
+ env->make_global_ref (env, local),
+ env->make_global_ref (env, local),
+ env->make_global_ref (env, env->intern (env, "foo")),
+ env->make_global_ref (env, env->intern (env, "bar")),
+ };
+ emacs_value elements[4];
+ for (int i = 0; i < 4; ++i)
+ elements[i] = booleans[env->eq (env, globals[i], local)];
+ emacs_value ret = env->funcall (env, env->intern (env, "list"), 4, elements);
+ env->free_global_ref (env, globals[2]);
+ env->free_global_ref (env, globals[1]);
+ env->free_global_ref (env, globals[3]);
+ env->free_global_ref (env, globals[0]);
+ return ret;
+}
+
+
/* Return a copy of the argument string where every 'a' is replaced
with 'b'. */
static emacs_value
@@ -708,6 +737,8 @@ emacs_module_init (struct emacs_runtime *ert)
DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL);
DEFUN ("mod-test-globref-invalid-free", Fmod_test_globref_invalid_free, 0, 0,
NULL, NULL);
+ 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-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL);
DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL);