branch: externals/pyim commit 0d835657f744d112ff4c8d36c72d6c5f94a8f567 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-process tests --- tests/pyim-tests.el | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index c23bf8a4c4..92acb66979 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -374,6 +374,12 @@ ("f" "en" "h" "eng")))))) ;; ** pyim-punctuation 相关单元测试 +(ert-deftest pyim-tests-pyim-punctuation-p () + (should (pyim-punctuation-p ?,)) + (should-not (pyim-punctuation-p ?,)) + (should-not (pyim-punctuation-p ?a)) + (should-not (pyim-punctuation-p ?1))) + (ert-deftest pyim-tests-pyim-punctuation () (with-temp-buffer (insert ",") @@ -2191,6 +2197,36 @@ abc 这是"))) (should (equal (pyim-process-next-word-position -4) 10)))) +(ert-deftest pyim-tests-pyim-process--trigger-delete-word-p () + (let ((pyim-default-scheme 'quanpin)) + (with-temp-buffer + (insert "你好2-") + (should (pyim-process--trigger-delete-word-p ?v))))) + +(ert-deftest pyim-tests-pyim-process--trigger-create-word-p () + (let ((pyim-default-scheme 'quanpin)) + (with-temp-buffer + (insert "你好2") + (should (pyim-process--trigger-create-word-p ?v))))) + +(ert-deftest pyim-tests-pyim-process--call-trigger-function-p () + (let ((pyim-default-scheme 'quanpin)) + (with-temp-buffer + (insert "你好") + (should (pyim-process--call-trigger-function-p ?v))))) + +(ert-deftest pyim-tests-pyim-process--translate-punctuation-to-full-width-p () + (let ((pyim-default-scheme 'quanpin)) + (with-temp-buffer + (insert ",") + (should (pyim-process--translate-punctuation-to-full-width-p ?v))))) + +(ert-deftest pyim-tests-pyim-process--translate-punctuation-to-half-width-p () + (let ((pyim-default-scheme 'quanpin)) + (with-temp-buffer + (insert ",") + (should (pyim-process--translate-punctuation-to-half-width-p ?v))))) + (ert-run-tests-batch-and-exit)