diff options
| author | Philipp Stephani | 2019-05-05 01:23:44 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2019-05-05 01:34:07 +0200 |
| commit | e95ecbe14681d86cb4ddd17edbb77559fdc9bc09 (patch) | |
| tree | 61ce9dbd588416416af383612871b1bd60b760af | |
| parent | 27a9377d4235462ba61e51fdb1239b61133b5aee (diff) | |
| download | emacs-e95ecbe14681d86cb4ddd17edbb77559fdc9bc09.tar.gz emacs-e95ecbe14681d86cb4ddd17edbb77559fdc9bc09.zip | |
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’.
| -rw-r--r-- | test/data/emacs-module/mod-test.c | 18 | ||||
| -rw-r--r-- | 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 a9154fa167d..fccc60fe4dd 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, | |||
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | static void | 318 | static void |
| 319 | signal_wrong_type_argument (emacs_env *env, const char *predicate, | ||
| 320 | emacs_value arg) | ||
| 321 | { | ||
| 322 | emacs_value symbol = env->intern (env, "wrong-type-argument"); | ||
| 323 | emacs_value elements[2] = {env->intern (env, predicate), arg}; | ||
| 324 | emacs_value data = env->funcall (env, env->intern (env, "list"), 2, elements); | ||
| 325 | env->non_local_exit_signal (env, symbol, data); | ||
| 326 | } | ||
| 327 | |||
| 328 | static void | ||
| 329 | signal_errno (emacs_env *env, const char *function) | 319 | signal_errno (emacs_env *env, const char *function) |
| 330 | { | 320 | { |
| 331 | const char *message = strerror (errno); | 321 | const char *message = strerror (errno); |
| @@ -345,16 +335,10 @@ Fmod_test_sleep_until (emacs_env *env, ptrdiff_t nargs, emacs_value *args, | |||
| 345 | void *data) | 335 | void *data) |
| 346 | { | 336 | { |
| 347 | assert (nargs == 2); | 337 | assert (nargs == 2); |
| 348 | const double until_seconds = env->extract_float (env, args[0]); | 338 | const struct timespec until = env->extract_time (env, args[0]); |
| 349 | if (env->non_local_exit_check (env)) | 339 | if (env->non_local_exit_check (env)) |
| 350 | return NULL; | 340 | return NULL; |
| 351 | if (until_seconds <= 0) | ||
| 352 | { | ||
| 353 | signal_wrong_type_argument (env, "cl-plusp", args[0]); | ||
| 354 | return NULL; | ||
| 355 | } | ||
| 356 | const bool process_input = env->is_not_nil (env, args[1]); | 341 | const bool process_input = env->is_not_nil (env, args[1]); |
| 357 | const struct timespec until = dtotimespec (until_seconds); | ||
| 358 | const struct timespec amount = make_timespec(0, 10000000); | 342 | const struct timespec amount = make_timespec(0, 10000000); |
| 359 | while (true) | 343 | while (true) |
| 360 | { | 344 | { |
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 60ba71c57b9..5349de055ed 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." | |||
| 313 | ;; Interactively, run for 5 seconds to give the | 313 | ;; Interactively, run for 5 seconds to give the |
| 314 | ;; user time to quit. In batch mode, run only | 314 | ;; user time to quit. In batch mode, run only |
| 315 | ;; briefly since the user can't quit. | 315 | ;; briefly since the user can't quit. |
| 316 | (float-time (time-add nil (if noninteractive 0.1 5))) | 316 | (time-add nil (if noninteractive 0.1 5)) |
| 317 | ;; should_quit or process_input | 317 | ;; should_quit or process_input |
| 318 | arg)) | 318 | arg)) |
| 319 | 'finished)) | 319 | 'finished)) |