emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim 841a207 1/2: * tests/pyim-tests.el (pyim-test-add-


From: ELPA Syncer
Subject: [elpa] externals/pyim 841a207 1/2: * tests/pyim-tests.el (pyim-test-add-dict): new function.
Date: Thu, 9 Dec 2021 21:57:43 -0500 (EST)

branch: externals/pyim
commit 841a207f243f24c4435690980e0f4480cd52d8c6
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    * tests/pyim-tests.el (pyim-test-add-dict): new function.
---
 tests/pyim-tests.el | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 43445ec..8cbf17e 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -35,20 +35,17 @@
 (require 'pyim-dhashcache)
 
 ;; ** 单元测试前的准备工作
-(defun pyim-test-get-pyim-basedict ()
-  "获取到 pyim-basedict.pyim 的信息."
-  (let* ((files (ignore-errors
-                  (directory-files-recursively
-                   (expand-file-name (concat default-directory "/deps/"))
-                   "pyim-basedict\.pyim$"))))
-    (when files
-      (mapcar (lambda (f)
-                (list :name (file-name-base f) :file f))
-              files))))
+(defun pyim-test-add-dict (file-name)
+  "搜索文件名称为 FILE-NAME 的词库,并添加到 `pyim-dicts'."
+  (let ((file (expand-file-name (concat default-directory "/deps/" 
file-name))))
+    (if (file-exists-p file)
+        (cl-pushnew
+         (list :name (file-name-base file) :file file)
+         pyim-dicts)
+      (message "pyim-test: fail to find dict file: '%s'." file))))
 
 (setq default-input-method "pyim")
-(when-let ((dicts (pyim-test-get-pyim-basedict)))
-  (setq pyim-dicts dicts))
+(pyim-test-add-dict "pyim-basedict.pyim")
 (pyim-dcache-init-variables)
 
 ;; ** pyim-common 相关单元测试



reply via email to

[Prev in Thread] Current Thread [Next in Thread]