branch: externals/pyim commit bf9e81f4187997c86da182060fa1356686b4c137 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
* tests/pyim-tests.el (pyim-tests-pyim-dhashcache-update-iword2count): New test. --- tests/pyim-tests.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index ec87f94..c91073a 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -708,6 +708,16 @@ zuo-zuo-you-mang 作作有芒") (pyim-dhashcache-delete-word "你好") (should (equal (gethash "ni-hao" pyim-dhashcache-icode2word) '("呢毫" "呢耗"))))) +(ert-deftest pyim-tests-pyim-dhashcache-update-iword2count () + (let ((pyim-dhashcache-iword2count (make-hash-table :test #'equal))) + (puthash "你好" 1 pyim-dhashcache-iword2count) + (pyim-dhashcache-update-iword2count "你好") + (should (equal (gethash "你好" pyim-dhashcache-iword2count) 2)) + (pyim-dhashcache-update-iword2count "你好" nil 10) + (should (equal (gethash "你好" pyim-dhashcache-iword2count) 10)) + (pyim-dhashcache-update-iword2count "你好" nil (lambda (x) (* x 2))) + (should (equal (gethash "你好" pyim-dhashcache-iword2count) 20)))) + ;; ** pyim-dregcache 相关单元测试 (ert-deftest pyim-tests-pyim-general () (let ((pyim-dcache-backend 'pyim-dregcache))