branch: externals/pyim commit 8786eee026aa40d881cefee534f4931d47249b0f Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
简化 test. * Makefile (@if [ ! -f deps/pyim-basedict.el ]; then curl -L https): download pyim-basedict.el (test): simplify. * tests/pyim-tests.el (pyim-basedict): required. (pyim-tests-add-dict): removed. (pyim-dicts, pyim-extra-dicts): set to nil. --- Makefile | 3 ++- tests/pyim-tests.el | 19 ++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 6a2146d3a0..36839498d7 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ deps: @if [ ! -f deps/async.el ]; then curl -L https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/async.el?h=externals/async > deps/async.el; fi; @if [ ! -f deps/popup.el ]; then curl -L https://git.savannah.gnu.org/cgit/emacs/nongnu.git/plain/popup.el?h=elpa/popup > deps/popup.el; fi; @if [ ! -f deps/pyim-basedict.pyim ]; then curl -L https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/pyim-basedict.pyim?h=externals/pyim-basedict > deps/pyim-basedict.pyim; fi; + @if [ ! -f deps/pyim-basedict.el ]; then curl -L https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/pyim-basedict.el?h=externals/pyim-basedict > deps/pyim-basedict.el; fi; .PHONY: test test: deps clean - @$(EMACS) -batch -Q -L . -l deps/xr.el -l deps/async.el -l deps/popup.el -l pyim.el -l tests/pyim-tests.el + @$(EMACS) -batch --quick --directory . --directory ./deps --load ./tests/pyim-tests.el diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index ff47c0521c..6063900b8b 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -31,26 +31,19 @@ ;; * 代码 :code: (require 'ert) (require 'pyim) +(require 'pyim-basedict) (require 'pyim-dregcache) (require 'pyim-dhashcache) -;; ** 单元测试前的准备工作 -(defun pyim-tests-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") -(pyim-tests-add-dict "pyim-basedict.pyim") -(pyim-dcache-init-variables) - +(setq pyim-dicts nil) +(setq pyim-extra-dicts nil) ;; 做测试的时候不保存词库,防止因为误操作导致个人词库损坏。 (defalias 'pyim-kill-emacs-hook-function #'ignore) +(pyim-basedict-enable) +(pyim-dcache-init-variables) + ;; ** pyim-schemes 相关单元测试 (ert-deftest pyim-tests-pyim-schemes () (let ((pyim-default-scheme 'wubi))