[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 21a663c 2/3: * tests/pyim-tests.el (pyim-tests-pyi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 21a663c 2/3: * tests/pyim-tests.el (pyim-tests-pyim-dcache-handle-variable): New test. |
Date: |
Tue, 14 Dec 2021 22:57:30 -0500 (EST) |
branch: externals/pyim
commit 21a663cdeac248a494d8d5a7be8203e69fbb9ffe
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* tests/pyim-tests.el (pyim-tests-pyim-dcache-handle-variable): New test.
---
tests/pyim-tests.el | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index cc5208a..8c2105a 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -626,6 +626,26 @@
(should (equal (gethash "ni-hao" (pyim-dcache-get-value-from-file file))
'("你好")))))
+(defvar pyim-tests-dcache-variable nil)
+(ert-deftest pyim-tests-pyim-dcache-handle-variable ()
+ (let ((pyim-dcache-directory
+ (file-name-as-directory (make-temp-name "pyim-dcache-"))))
+
+ (pyim-dcache-save-variable 'pyim-tests-dcache-variable "hello")
+ (should (equal (pyim-dcache-get-value 'pyim-tests-dcache-variable)
"hello"))
+
+ (setq pyim-tests-dcache-variable "hi")
+ (pyim-dcache-reload-variable 'pyim-tests-dcache-variable)
+ (should (equal pyim-tests-dcache-variable "hello"))
+
+ (setq pyim-tests-dcache-variable "hi")
+ (pyim-dcache-init-variable 'pyim-tests-dcache-variable)
+ (should (equal pyim-tests-dcache-variable "hi"))
+
+ (setq pyim-tests-dcache-variable nil)
+ (pyim-dcache-init-variable 'pyim-tests-dcache-variable)
+ (should (equal pyim-tests-dcache-variable "hello"))))
+
;; ** pyim-dhashcache 相关单元测试
(ert-deftest pyim-tests-pyim-dhashcache-get-shortcodes ()
(should (equal (pyim-dhashcache-get-shortcodes ".abcde") nil))