emacs-diffs
[Top][All Lists]
Advanced

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

master 2ec39734ca: EUDC: Add BBDB test


From: Thomas Fitzsimmons
Subject: master 2ec39734ca: EUDC: Add BBDB test
Date: Sat, 19 Nov 2022 11:44:26 -0500 (EST)

branch: master
commit 2ec39734ca03e075f2515f178ed789872e52f98f
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>

    EUDC: Add BBDB test
    
    * test/lisp/net/eudc-tests.el (eudcb-ldap): Call skip-unless with
    slapd check.
    (eudcb-bbdb): New test.
---
 test/lisp/net/eudc-resources/bbdb |  3 +++
 test/lisp/net/eudc-tests.el       | 54 ++++++++++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/test/lisp/net/eudc-resources/bbdb 
b/test/lisp/net/eudc-resources/bbdb
new file mode 100644
index 0000000000..b730bb51cc
--- /dev/null
+++ b/test/lisp/net/eudc-resources/bbdb
@@ -0,0 +1,3 @@
+;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
+;;; file-format: 9
+["Emacs" "ERT3" nil nil nil nil nil ("emacs-ert-test-3@bbdb.gnu.org") ((notes 
. " ")) "c8bd3a63-3a83-48a7-a95b-be118a923e00" "2022-11-19 16:36:04 +0000" 
"2022-11-19 16:36:04 +0000" nil]
diff --git a/test/lisp/net/eudc-tests.el b/test/lisp/net/eudc-tests.el
index 59dce55b82..212db65cb2 100644
--- a/test/lisp/net/eudc-tests.el
+++ b/test/lisp/net/eudc-tests.el
@@ -270,24 +270,42 @@ Karl Fogel <kfogel@mail-abbrev.com")))))))))
 (require 'ldap)
 (ert-deftest eudcb-ldap ()
   "Test the LDAP back-end."
-  (when (and (file-exists-p "/usr/sbin/slapd")
-             (file-exists-p "/usr/bin/ldapsearch"))
-    (cd (concat (ert-resource-directory) ".."))
-    (let ((ldap-process
-           (start-process "slapd" "*slapd*" "/usr/sbin/slapd"
-                          "-h" "ldap://127.0.0.1:3899"; "-d" "0" "-4"
-                          "-f" (ert-resource-file "slapd.conf")))
-          (ldap-host-parameters-alist '(("ldap://localhost:3899";
-                                         base "dc=gnu,dc=org" auth simple)))
-          (eudc-server-hotlist '(("ldap://localhost:3899"; . ldap)))
-          (eudc-ignore-options-file t))
-      (sleep-for 1) ; Wait for slapd to start.
-      (should (equal (with-temp-buffer
-                       (insert "emacs-ert-test-1")
-                       (eudc-expand-try-all)
-                       (buffer-string))
-                     "Emacs ERT1 <emacs-ert-test-1@ldap.gnu.org>"))
-      (kill-process ldap-process))))
+  (skip-unless (and (file-exists-p "/usr/sbin/slapd")
+                    (file-exists-p "/usr/bin/ldapsearch")))
+  (cd (concat (ert-resource-directory) ".."))
+  (let ((ldap-process
+         (start-process "slapd" "*slapd*" "/usr/sbin/slapd"
+                        "-h" "ldap://127.0.0.1:3899"; "-d" "0" "-4"
+                        "-f" (ert-resource-file "slapd.conf")))
+        (ldap-host-parameters-alist '(("ldap://localhost:3899";
+                                       base "dc=gnu,dc=org" auth simple)))
+        (eudc-server-hotlist '(("ldap://localhost:3899"; . ldap)))
+        (eudc-ignore-options-file t))
+    (sleep-for 1) ; Wait for slapd to start.
+    (should (equal (with-temp-buffer
+                     (insert "emacs-ert-test-1")
+                     (eudc-expand-try-all)
+                     (buffer-string))
+                   "Emacs ERT1 <emacs-ert-test-1@ldap.gnu.org>"))
+    (kill-process ldap-process)))
+
+(eval-and-compile
+  (push (expand-file-name "../elpa/packages/bbdb/lisp" source-directory)
+        load-path)
+  (defvar bbdb-file)
+  (require 'bbdb nil t))
+
+(ert-deftest eudcb-bbdb ()
+  "Test the BBDB back-end."
+  (skip-unless (featurep 'bbdb))
+  (let ((bbdb-file (ert-resource-file "bbdb"))
+        (eudc-server-hotlist '(("" . bbdb)))
+        (eudc-ignore-options-file t))
+    (should (equal (with-temp-buffer
+                     (insert "emacs-ert-test-3")
+                     (eudc-expand-try-all)
+                     (buffer-string))
+                   "Emacs ERT3 <emacs-ert-test-3@bbdb.gnu.org>"))))
 
 (provide 'eudc-tests)
 ;;; eudc-tests.el ends here



reply via email to

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