[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 8ebba5d 178/350: Very basic test setup
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 8ebba5d 178/350: Very basic test setup |
Date: |
Mon, 14 Aug 2017 11:46:30 -0400 (EDT) |
branch: externals/ebdb
commit 8ebba5de4c67328729361740736fd9d36c264992
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Very basic test setup
* ebdb-test.el: New file containing tests for EBDB. Very few tests at
this point. Most crucial to test parsing and snarfing -- anything
involving regexps.
---
ebdb-test.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/ebdb-test.el b/ebdb-test.el
new file mode 100644
index 0000000..a1598a3
--- /dev/null
+++ b/ebdb-test.el
@@ -0,0 +1,70 @@
+;;; ebdb-test.el --- Tests for EBDB -*- lexical-binding: t;
-*-
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; Author: Eric Abrahamsen <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Tests for EBDB.
+
+;;; Code:
+
+(require 'ert)
+(require 'pcase)
+(require 'ebdb)
+(require 'ebdb-snarf)
+
+;; Very basic sanity tests for field instances.
+
+(ert-deftest ebdb-parse-mail-and-name ()
+ "Go through some basic field classes and ensure that a string
+ run through `ebdb-parse' and `ebdb-string' remains the same."
+ (let ((pairs
+ '((ebdb-field-mail "address@hidden")
+ (ebdb-field-mail "Eric Abrahamsen <address@hidden>")
+ (ebdb-field-name "Eric Abrahamsen")
+ (ebdb-field-name "Eric P. Abrahamsen, III"))))
+ (dolist (p pairs)
+ (should (equal (ebdb-string (ebdb-parse (car p) (nth 1 p)))
+ (nth 1 p))))))
+
+;; Snarf testing.
+
+(ert-deftest ebdb-snarf-mail-and-name ()
+ (let ((test-texts
+ '("Eric Abrahamsen <address@hidden>"
+ "Eric Abrahamsen address@hidden"
+ "Eric Abrahamsen \n <address@hidden>"
+ "Eric Abrahamsen can't hold his drink\n<address@hidden> is where you
can write and tell him so."))
+ result)
+ (dolist (text test-texts)
+ (with-temp-buffer
+ (insert text)
+ (setq result (car (ebdb-snarf-collect)))
+ (pcase result
+ (`[nil (,name) (,mail)]
+ (unless (string= (ebdb-string name) "Eric Abrahamsen")
+ (ert-fail (list (format "Parsing \"%s\" resulted in name %s"
+ text (ebdb-string name)))))
+ (unless (string= (ebdb-string mail) "address@hidden")
+ (ert-fail (list (format "Parsing \"%s\" resulted in mail %s"
+ text (ebdb-string mail))))))
+ (_ (ert-fail (list (format "Parsing \"%s\" resulted in %s"
+ text result)))))))))
+
+(provide 'ebdb-test)
+;;; ebdb-test.el ends here
- [elpa] externals/ebdb a8e0221 179/350: Missing local variable binding, (continued)
- [elpa] externals/ebdb a8e0221 179/350: Missing local variable binding, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e71548d 172/350: Allow for characters before mail addresses when snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 14b03b5 186/350: Fix menu entry of ebdb-create-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 10c1e76 185/350: When replying to messages, start with a populated EBDB buffer, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b9e6034 187/350: Increase base field indentation in *EBDB* buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a19ff0a 168/350: Simplify pop-up window splitting, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4c6b6f5 190/350: Protect gnus stuff behind eval-after-load, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e0c3311 177/350: Fix parsing of suffixes in names, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 429cdb0 183/350: Add safety check to ebdb-undisplay-records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 744c829 182/350: Clear *EBDB-Message* buffers when composing new message, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8ebba5d 178/350: Very basic test setup,
Eric Abrahamsen <=
- [elpa] externals/ebdb 927c2ac 188/350: Be more careful about name formatting, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e52e17e 192/350: Pop up EBDB buffer when using company to complete, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb fc1a480 191/350: Fix ebdb-delete-redundant-mails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 61dcb8c 148/350: Re-initialize database records after reloading, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8694194 150/350: Use string-match-p for searching on Org tags, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e4c0442 162/350: Fix up actions and EBDB buffer menus, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 09e421f 156/350: Rework anniversary/diary integration, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a8e44ee 175/350: Update company-ebdb for new search behavior, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ece91cb 176/350: Remove spurious ebdb-record-search implementation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 86a3aa9 180/350: Change signature of ebdb-undisplay-records, Eric Abrahamsen, 2017/08/14