Fix `org-contacts-identity-properties-list' list elements not expanded.
[org-contacts.git] / test-org-contacts.el
bloba2de7493c21553345a1d462ec68f80801fe1df42
1 ;;; test-org-contacts.el --- org-contacts testing -*- lexical-binding: t; -*-
2 ;; -*- coding: utf-8 -*-
4 ;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
6 ;;; Commentary:
10 ;;; Code:
12 (require 'ert)
15 (ert-deftest ert-test-org-contacts-property-email-value-extracting-regexp ()
16 "Testing org-contacts property `EMAIL' value extracting regexp rule."
17 (let ((regexp-rule
18 ;; "\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]" ; valid
19 "\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\(,\\ *\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\)" ; valid
21 (let ((pvalue "huangtc@outlook.com")) ; normal email
22 (if (string-match regexp-rule pvalue)
23 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
24 pvalue))
26 (let ((pvalue "huangtc@outlook.com,")) ; has comma separator
27 (if (string-match regexp-rule pvalue)
28 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
29 pvalue))
31 (let ((pvalue "huangtc@outlook.com, tristan.j.huang@gmail.com,"))
32 (if (string-match regexp-rule pvalue)
33 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
34 pvalue))
36 (let ((pvalue "[[mailto:yantar92@posteo.net]]"))
37 (if (string-match regexp-rule pvalue)
38 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
39 pvalue))
41 (let ((pvalue "[[mailto:yantar92@posteo.net][yantar92@posteo.net]]"))
42 (if (string-match regexp-rule pvalue)
43 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
44 pvalue))
46 (let ((pvalue "[[mailto:yantar92@posteo.net][yantar92@posteo.net]], [[mailto:yantar92@gmail.com][yantar92@gmail.com]]"))
47 (if (string-match regexp-rule pvalue)
48 (should (string-equal (match-string 1 pvalue) "yantar92@posteo.net"))
49 pvalue))
52 ;;; literal testing
54 ;; (let ((regexp-rule "\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]")
55 ;; (pvalue "[[mailto:yantar92@posteo.net][yantar92@posteo.net]]"))
56 ;; (if (string-match regexp-rule pvalue)
57 ;; (match-string 1 pvalue)
58 ;; pvalue))
60 ;; (let ((regexp-rule "\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\(,\\ *\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\)")
61 ;; (pvalue "[[mailto:yantar92@posteo.net][yantar92@posteo.net]], [[mailto:yantar92@gmail.com][yantar92@gmail.com]]"))
62 ;; (if (string-match regexp-rule pvalue)
63 ;; (match-string 1 pvalue)
64 ;; pvalue))
68 (provide 'test-org-contacts)
70 ;;; test-org-contacts.el ends here