emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ebdb aea28d9 313/350: Add test for with-record-edits ma


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb aea28d9 313/350: Add test for with-record-edits macro
Date: Mon, 14 Aug 2017 11:47:01 -0400 (EDT)

branch: externals/ebdb
commit aea28d9fc8bae85df1c530b0c72e896ebd3ba9e5
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Add test for with-record-edits macro
    
    * ebdb-test.el (ebdb-test-with-record-edits): I'm least confident
      about this macro.
---
 ebdb-test.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/ebdb-test.el b/ebdb-test.el
index 2743302..d893b69 100644
--- a/ebdb-test.el
+++ b/ebdb-test.el
@@ -130,6 +130,25 @@
            rec (ebdb-parse 'ebdb-field-mail "address@hidden"))
           :type 'ebdb-readonly-db))))))
 
+(ert-deftest ebdb-test-with-record-edits ()
+  "Test the `ebdb-with-record-edits' macro."
+  (ebdb-test-with-records
+    (ebdb-test-with-database (db1 ebdb-test-database-1)
+      (ebdb-test-with-database (db2 ebdb-test-database-2)
+       (let ((rec1 (make-instance 'ebdb-record-person))
+             (rec2 (make-instance 'ebdb-record-person)))
+         (ebdb-db-add-record db1 rec1)
+         (ebdb-db-add-record db2 rec1)
+         (ebdb-db-add-record db1 rec2)
+         (setf (slot-value db2 'read-only) t)
+         (ebdb-with-record-edits (r (list rec1 rec2))
+           (ebdb-record-insert-field
+            r (ebdb-parse 'ebdb-field-mail "address@hidden")))
+         ;; rec1 should have been excluded from the list of editable
+         ;; records, but no error should be raised.
+         (should-not
+          (slot-value rec1 'mail)))))))
+
 ;; Test adding, deleting and changing fields.
 
 (ert-deftest ebdb-add-delete-record-field ()



reply via email to

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