emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e95ecbe 1/2: Use extract_time in test module.


From: Philipp Stephani
Subject: [Emacs-diffs] master e95ecbe 1/2: Use extract_time in test module.
Date: Sat, 4 May 2019 19:35:51 -0400 (EDT)

branch: master
commit e95ecbe14681d86cb4ddd17edbb77559fdc9bc09
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Use extract_time in test module.
    
    * test/data/emacs-module/mod-test.c (Fmod_test_sleep_until): Use
    extract_time for time argument.
    (signal_wrong_type_argument): Remove unused function.
    
    * test/src/emacs-module-tests.el (mod-test-sleep-until): Remove
    unnecessary ‘float-time’.
---
 test/data/emacs-module/mod-test.c | 18 +-----------------
 test/src/emacs-module-tests.el    |  2 +-
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/test/data/emacs-module/mod-test.c 
b/test/data/emacs-module/mod-test.c
index a9154fa..fccc60f 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -316,16 +316,6 @@ Fmod_test_invalid_finalizer (emacs_env *env, ptrdiff_t 
nargs, emacs_value *args,
 }
 
 static void
-signal_wrong_type_argument (emacs_env *env, const char *predicate,
-                            emacs_value arg)
-{
-  emacs_value symbol = env->intern (env, "wrong-type-argument");
-  emacs_value elements[2] = {env->intern (env, predicate), arg};
-  emacs_value data = env->funcall (env, env->intern (env, "list"), 2, 
elements);
-  env->non_local_exit_signal (env, symbol, data);
-}
-
-static void
 signal_errno (emacs_env *env, const char *function)
 {
   const char *message = strerror (errno);
@@ -345,16 +335,10 @@ Fmod_test_sleep_until (emacs_env *env, ptrdiff_t nargs, 
emacs_value *args,
                        void *data)
 {
   assert (nargs == 2);
-  const double until_seconds = env->extract_float (env, args[0]);
+  const struct timespec until = env->extract_time (env, args[0]);
   if (env->non_local_exit_check (env))
     return NULL;
-  if (until_seconds <= 0)
-    {
-      signal_wrong_type_argument (env, "cl-plusp", args[0]);
-      return NULL;
-    }
   const bool process_input = env->is_not_nil (env, args[1]);
-  const struct timespec until = dtotimespec (until_seconds);
   const struct timespec amount = make_timespec(0,  10000000);
   while (true)
     {
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 60ba71c..5349de0 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -313,7 +313,7 @@ Interactively, you can try hitting \\[keyboard-quit] to 
quit."
                          ;; Interactively, run for 5 seconds to give the
                          ;; user time to quit.  In batch mode, run only
                          ;; briefly since the user can't quit.
-                         (float-time (time-add nil (if noninteractive 0.1 5)))
+                         (time-add nil (if noninteractive 0.1 5))
                          ;; should_quit or process_input
                          arg))
                       'finished))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]