]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.el
emacs: Various cosmetic changes
[notmuch] / test / test-lib.el
index aae9e8333f5f7558b4116b83c5263774a5769782..e9e7c3798770e53c33fe7020133199b80e3d9982 100644 (file)
@@ -36,7 +36,7 @@
 
 ;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
 ;; noninteractive (kill-emacs) from emacsclient.
-(if (and (= emacs-major-version 23) (< emacs-minor-version 3))
+(when (and (= emacs-major-version 23) (< emacs-minor-version 3))
   (defadvice kill-emacs (before disable-yes-or-no-p activate)
     "Disable yes-or-no-p before executing kill-emacs"
     (defun yes-or-no-p (prompt) t)))
@@ -46,7 +46,7 @@
 ;; seems to be present in Emacs 23.1.
 ;; Running `list-processes' after `accept-process-output' seems to work
 ;; around this problem.
-(if (and (= emacs-major-version 23) (= emacs-minor-version 1))
+(when (and (= emacs-major-version 23) (= emacs-minor-version 1))
   (defadvice accept-process-output (after run-list-processes activate)
     "run list-processes after executing accept-process-output"
     (list-processes)))
@@ -81,7 +81,7 @@ invisible text."
   (let (str)
     (while (< start end)
       (let ((next-pos (next-char-property-change start end)))
-       (when (not (invisible-p start))
+       (unless (invisible-p start)
          (setq str (concat str (buffer-substring-no-properties
                                 start next-pos))))
        (setq start next-pos)))
@@ -97,8 +97,8 @@ invisible text."
 (defun orphan-watchdog-check (pid)
   "Periodically check that the process with id PID is still
 running, quit if it terminated."
-  (if (not (test-process-running pid))
-      (kill-emacs)))
+  (unless (test-process-running pid)
+    (kill-emacs)))
 
 (defun orphan-watchdog (pid)
   "Initiate orphan watchdog check."
@@ -154,22 +154,21 @@ running, quit if it terminated."
 
 (defun notmuch-test-expect-equal (output expected)
   "Compare OUTPUT with EXPECTED. Report any discrepencies."
-  (if (equal output expected)
-      t
-    (cond
-     ((and (listp output)
-          (listp expected))
-      ;; Reporting the difference between two lists is done by
-      ;; reporting differing elements of OUTPUT and EXPECTED
-      ;; pairwise. This is expected to make analysis of failures
-      ;; simpler.
-      (apply #'concat (cl-loop for o in output
-                              for e in expected
-                              if (not (equal o e))
-                              collect (notmuch-test-report-unexpected o e))))
-
-     (t
-      (notmuch-test-report-unexpected output expected)))))
+  (cond
+   ((equal output expected)
+    t)
+   ((and (listp output)
+        (listp expected))
+    ;; Reporting the difference between two lists is done by
+    ;; reporting differing elements of OUTPUT and EXPECTED
+    ;; pairwise. This is expected to make analysis of failures
+    ;; simpler.
+    (apply #'concat (cl-loop for o in output
+                            for e in expected
+                            if (not (equal o e))
+                            collect (notmuch-test-report-unexpected o e))))
+   (t
+    (notmuch-test-report-unexpected output expected))))
 
 (defun notmuch-post-command ()
   (run-hooks 'post-command-hook))