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

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

[elpa] externals/pyim 1f32674: * tests/pyim-tests.el (pyim-tests-pyim-dc


From: ELPA Syncer
Subject: [elpa] externals/pyim 1f32674: * tests/pyim-tests.el (pyim-tests-pyim-dcache-export): New test.
Date: Wed, 15 Dec 2021 02:57:26 -0500 (EST)

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

    * tests/pyim-tests.el (pyim-tests-pyim-dcache-export): New test.
---
 tests/pyim-tests.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index dc0c8b0..2d332ac 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -646,6 +646,29 @@
     (pyim-dcache-init-variable my/test:1)
     (should (equal my/test:1 "hello"))))
 
+(ert-deftest pyim-tests-pyim-dcache-export ()
+  (let ((pyim-dhashcache-iword2count (make-hash-table :test #'equal))
+        (pyim-dhashcache-icode2word (make-hash-table :test #'equal))
+        (file (make-temp-file "pyim-dcache-export-")))
+    (puthash "你好" 10 pyim-dhashcache-iword2count)
+    (puthash "尼耗" 1 pyim-dhashcache-iword2count)
+    (puthash "ni-hao" (list "你好" "尼耗") pyim-dhashcache-icode2word)
+    (pyim-dcache-export-words-and-counts file)
+    (with-temp-buffer
+      (insert-file-contents file)
+      (should (equal (buffer-string)
+                     ";;; -*- coding: utf-8-unix -*-
+你好 10
+尼耗 1
+")))
+    (pyim-dcache-export-personal-words file)
+    (with-temp-buffer
+      (insert-file-contents file)
+      (should (equal (buffer-string)
+                     ";;; -*- coding: utf-8-unix -*-
+ni-hao 你好 尼耗
+")))))
+
 ;; ** pyim-dhashcache 相关单元测试
 (ert-deftest pyim-tests-pyim-dhashcache-get-shortcodes ()
   (should (equal (pyim-dhashcache-get-shortcodes ".abcde") nil))



reply via email to

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