aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Eggert2017-10-20 19:40:09 -0700
committerPaul Eggert2017-10-20 19:42:23 -0700
commitc75f505dea6a560b825384cf3d277690f86840bf (patch)
tree5a4463599b2498f0fd59e32167f99da8d8320336 /test
parentc73769255c70fc0dc529a9b5c73cd5b4cfb05817 (diff)
downloademacs-c75f505dea6a560b825384cf3d277690f86840bf.tar.gz
emacs-c75f505dea6a560b825384cf3d277690f86840bf.zip
Prefer nil to (current-time) when either works
* doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/char-fold-tests.el6
-rw-r--r--test/manual/cedet/semantic-ia-utest.el2
-rw-r--r--test/manual/cedet/semantic-tests.el12
3 files changed, 8 insertions, 12 deletions
diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el
index 83d6fa79b1e..a16f2879809 100644
--- a/test/lisp/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
@@ -117,16 +117,14 @@
117 (char-fold-to-regexp string))) 117 (char-fold-to-regexp string)))
118 (with-temp-buffer 118 (with-temp-buffer
119 (save-excursion (insert string)) 119 (save-excursion (insert string))
120 (let ((time (time-to-seconds (current-time)))) 120 (let ((time (time-to-seconds)))
121 ;; Our initial implementation of case-folding in char-folding 121 ;; Our initial implementation of case-folding in char-folding
122 ;; created a lot of redundant paths in the regexp. Because of 122 ;; created a lot of redundant paths in the regexp. Because of
123 ;; that, if a really long string "almost" matches, the regexp 123 ;; that, if a really long string "almost" matches, the regexp
124 ;; engine took a long time to realize that it doesn't match. 124 ;; engine took a long time to realize that it doesn't match.
125 (should-not (char-fold-search-forward (concat string "c") nil 'noerror)) 125 (should-not (char-fold-search-forward (concat string "c") nil 'noerror))
126 ;; Ensure it took less than a second. 126 ;; Ensure it took less than a second.
127 (should (< (- (time-to-seconds (current-time)) 127 (should (< (- (time-to-seconds) time) 1))))))
128 time)
129 1))))))
130 128
131(provide 'char-fold-tests) 129(provide 'char-fold-tests)
132;;; char-fold-tests.el ends here 130;;; char-fold-tests.el ends here
diff --git a/test/manual/cedet/semantic-ia-utest.el b/test/manual/cedet/semantic-ia-utest.el
index 7861fd73949..53cff05adc4 100644
--- a/test/manual/cedet/semantic-ia-utest.el
+++ b/test/manual/cedet/semantic-ia-utest.el
@@ -434,7 +434,7 @@ tag that contains point, and return that."
434 (when (interactive-p) 434 (when (interactive-p)
435 (message "Found %d occurrences of %s in %.2f seconds" 435 (message "Found %d occurrences of %s in %.2f seconds"
436 Lcount (semantic-tag-name target) 436 Lcount (semantic-tag-name target)
437 (semantic-elapsed-time start (current-time)))) 437 (semantic-elapsed-time start nil)))
438 Lcount))) 438 Lcount)))
439 439
440(defun semantic-src-utest-buffer-refs () 440(defun semantic-src-utest-buffer-refs ()
diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el
index 3a19328ac79..0495170058a 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -178,9 +178,8 @@ Optional argument ARG specifies not to use color."
178 "Test `semantic-idle-scheduler-work-parse-neighboring-files' and time it." 178 "Test `semantic-idle-scheduler-work-parse-neighboring-files' and time it."
179 (interactive) 179 (interactive)
180 (let ((start (current-time)) 180 (let ((start (current-time))
181 (junk (semantic-idle-scheduler-work-parse-neighboring-files)) 181 (junk (semantic-idle-scheduler-work-parse-neighboring-files)))
182 (end (current-time))) 182 (message "Work took %.2f seconds." (semantic-elapsed-time start nil))))
183 (message "Work took %.2f seconds." (semantic-elapsed-time start end))))
184 183
185;;; From semantic-lex: 184;;; From semantic-lex:
186 185
@@ -195,10 +194,9 @@ If universal argument ARG, then try the whole buffer."
195 (result (semantic-lex 194 (result (semantic-lex
196 (if arg (point-min) (point)) 195 (if arg (point-min) (point))
197 (point-max) 196 (point-max)
198 100)) 197 100)))
199 (end (current-time)))
200 (message "Elapsed Time: %.2f seconds." 198 (message "Elapsed Time: %.2f seconds."
201 (semantic-elapsed-time start end)) 199 (semantic-elapsed-time start nil))
202 (pop-to-buffer "*Lexer Output*") 200 (pop-to-buffer "*Lexer Output*")
203 (require 'pp) 201 (require 'pp)
204 (erase-buffer) 202 (erase-buffer)
@@ -278,7 +276,7 @@ tag that contains point, and return that."
278 (when (interactive-p) 276 (when (interactive-p)
279 (message "Found %d occurrences of %s in %.2f seconds" 277 (message "Found %d occurrences of %s in %.2f seconds"
280 Lcount (semantic-tag-name target) 278 Lcount (semantic-tag-name target)
281 (semantic-elapsed-time start (current-time)))) 279 (semantic-elapsed-time start nil)))
282 Lcount))) 280 Lcount)))
283 281
284;;; From bovine-gcc: 282;;; From bovine-gcc: