1 ;;; test-org-contacts.el --- org-contacts testing -*- lexical-binding: t; -*-
2 ;; -*- coding: utf-8 -*-
4 ;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
15 (ert-deftest ert-test-org-contacts-property-email-value-extracting-regexp
()
16 "Testing org-contacts property `EMAIL' value extracting 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"))
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"))
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"))
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"))
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"))
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"))
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)
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)
68 (provide 'test-org-contacts
)
70 ;;; test-org-contacts.el ends here