[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 69b0058 32/62: Remove test dependency on dictionary file
From: |
Ian Dunn |
Subject: |
[elpa] master 69b0058 32/62: Remove test dependency on dictionary file |
Date: |
Sat, 9 Dec 2017 14:34:01 -0500 (EST) |
branch: master
commit 69b005851bbca1480fa8e0e3884e6140ac8d77d7
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Remove test dependency on dictionary file
---
paced-tests.el | 136 ++++++++++++++++++++++++++++++---------------------------
1 file changed, 71 insertions(+), 65 deletions(-)
diff --git a/paced-tests.el b/paced-tests.el
index 041f4d0..16c80f6 100644
--- a/paced-tests.el
+++ b/paced-tests.el
@@ -32,9 +32,9 @@
(defsubst paced-test-file (base-name)
(expand-file-name base-name paced-test-dir))
-(defconst paced-first-test-file (paced-test-file "first.txt"))
+(defconst paced-first-test-file (paced-test-file "first.txt"))
(defconst paced-second-test-file (paced-test-file "second.cpp"))
-(defconst paced-third-test-file (paced-test-file "third.org"))
+(defconst paced-third-test-file (paced-test-file "third.org"))
(defconst paced-test-dict-save-file (paced-test-file
"paced-dictionary-case-sensitive"))
(defconst paced-test-default-registered-map (make-hash-table :test 'equal))
@@ -59,10 +59,10 @@
(should-not (paced-mixed-case-word-p "has")))
(ert-deftest paced-create-dictionary ()
+ ;; Delete the old save file
+ (when (file-exists-p paced-test-dict-save-file)
+ (delete-file paced-test-dict-save-file))
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
- (target-file-exists (file-exists-p paced-test-dict-save-file))
- (old-mod-time (and target-file-exists
- (file-attribute-modification-time (file-attributes
paced-test-dict-save-file))))
(new-dict (paced-make-dictionary "test-dict-case"
paced-test-dict-save-file
'downcase)))
@@ -70,19 +70,13 @@
(should (paced-dictionary-p new-dict))
(oset new-dict updated t) ;; Mark it as updated so it saves
(paced-dictionary-save new-dict)
- (should (file-exists-p paced-test-dict-save-file))
- ;; Either it didn't exist before, or the old mod time is before the new mod
- ;; time. In other words, it updated.
- (should (or (not target-file-exists)
- (time-less-p old-mod-time
- (file-attribute-modification-time
(file-attributes paced-test-dict-save-file)))))))
-
-(ert-deftest paced-load-dictionary ()
+ (should (file-exists-p paced-test-dict-save-file)))
(let* ((paced--registered-dictionaries paced-test-default-registered-map))
+ ;; Now verify that we can load it again
(paced-load-dictionary-from-file paced-test-dict-save-file)
(should (= (map-length paced--registered-dictionaries) 1))
(should (map-contains-key paced--registered-dictionaries "test-dict-case"))
- (should (paced-dictionary-p (map-elt paced--registered-dictionaries
"test-dict-case" nil)))))
+ (should (paced-dictionary-p (paced-named-dictionary "test-dict-case")))))
(defvar paced-test-enable-symbol nil)
@@ -90,8 +84,10 @@
"Test case for `paced-dictionary-enable-alist' being an arbitrary symbol."
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((paced-test-enable-symbol .
"test-dict-case")))
- (new-buffer (find-file-noselect paced-first-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (new-buffer (find-file-noselect paced-first-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer new-buffer
(setq paced-test-enable-symbol nil)
(should-not (paced-current-dictionary))
@@ -105,8 +101,10 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
- (buffer-two (find-file-noselect paced-second-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (buffer-two (find-file-noselect paced-second-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer buffer-two
(should-not (paced-current-dictionary)))
(kill-buffer buffer-two)
@@ -122,8 +120,10 @@
"Test case for `paced-dictionary-enable-alist' being a function symbol."
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((paced-test-function-symbol .
"test-dict-case")))
- (buffer-one (find-file-noselect paced-first-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (buffer-one (find-file-noselect paced-first-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer buffer-one
(setq-local paced-test-enable-symbol nil)
(should-not (paced-current-dictionary))
@@ -136,8 +136,10 @@
"Test case for `paced-dictionary-enable-alist' being a lambda form."
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '(((lambda nil
paced-test-enable-symbol) . "test-dict-case")))
- (buffer-one (find-file-noselect paced-first-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (buffer-one (find-file-noselect paced-first-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer buffer-one
(setq-local paced-test-enable-symbol nil)
(should-not (paced-current-dictionary))
@@ -151,8 +153,10 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '(((and text-mode
paced-test-enable-symbol) . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
- (buffer-two (find-file-noselect paced-second-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (buffer-two (find-file-noselect paced-second-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer buffer-two
(setq-local paced-test-enable-symbol nil)
(should-not (paced-current-dictionary))
@@ -172,8 +176,10 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '(((or text-mode
paced-test-enable-symbol) . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
- (buffer-two (find-file-noselect paced-second-test-file)))
- (paced-load-dictionary-from-file paced-test-dict-save-file)
+ (buffer-two (find-file-noselect paced-second-test-file))
+ (new-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(with-current-buffer buffer-two
(setq-local paced-test-enable-symbol nil)
(should-not (paced-current-dictionary))
@@ -195,9 +201,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -216,9 +222,9 @@
(buffer "first.txt")
(buffer-one (find-file-noselect paced-first-test-file))
(cmd (paced-buffer-population-command :buffer buffer))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -238,9 +244,9 @@
(pre-func (lambda () (insert (buffer-string)) t))
(cmd (paced-file-function-population-command :file
paced-first-test-file
:setup-func pre-func))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -259,9 +265,9 @@
(cmd (paced-directory-regexp-population-command :directory
paced-test-dir
:regexp ".*\\.txt"
:recursive t))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -279,9 +285,9 @@
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(file-list (lambda () `(,paced-first-test-file)))
(cmd (paced-file-list-population-command :generator file-list))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -298,9 +304,9 @@
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd1 (paced-file-population-command :file paced-first-test-file))
(cmd2 (paced-file-population-command :file paced-third-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd1 cmd2))
(paced-dictionary-repopulate test-dict)
@@ -322,9 +328,9 @@
(cmd1 (paced-file-population-command :file paced-first-test-file))
(cmd2 (paced-file-population-command :file paced-second-test-file
:props `((paced-exclude-function
quote ,exclude-command))))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd1 cmd2))
(paced-dictionary-repopulate test-dict)
@@ -341,9 +347,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -359,9 +365,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(file "first.txt")
(cmd (paced-file-population-command :file file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -372,9 +378,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(buffer "first.txt")
(cmd (paced-buffer-population-command :buffer buffer))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -385,9 +391,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -398,9 +404,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
@@ -417,9 +423,9 @@
(let* ((paced--registered-dictionaries paced-test-default-registered-map)
(paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
- test-dict)
- (paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary "test-dict-case"))
+ (test-dict (paced-make-dictionary "test-dict-case"
+ paced-test-dict-save-file
+ 'downcase)))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-dictionary-repopulate test-dict)
- [elpa] master 56944b8 44/62: Added documentation section for working with EDE, (continued)
- [elpa] master 56944b8 44/62: Added documentation section for working with EDE, Ian Dunn, 2017/12/09
- [elpa] master 895f479 41/62: Pushed info pages, Ian Dunn, 2017/12/09
- [elpa] master 223809e 61/62: Fixed elpaignore file, Ian Dunn, 2017/12/09
- [elpa] master 2e306c8 40/62: Improved Introduction, Ian Dunn, 2017/12/09
- [elpa] master 139a199 53/62: Added note about dictionary properties, Ian Dunn, 2017/12/09
- [elpa] master 1234c0c 54/62: Updated info pages, Ian Dunn, 2017/12/09
- [elpa] master a3a7eac 51/62: Added default dictionary settings for population, Ian Dunn, 2017/12/09
- [elpa] master 7535133 58/62: Updated copyright blocks in all files, Ian Dunn, 2017/12/09
- [elpa] master bfdb640 43/62: Updated pabbrev comparison, Ian Dunn, 2017/12/09
- [elpa] master 4823f53 55/62: Added section for a basic setup, Ian Dunn, 2017/12/09
- [elpa] master 69b0058 32/62: Remove test dependency on dictionary file,
Ian Dunn <=
- [elpa] master 534df41 57/62: Updated info pages, Ian Dunn, 2017/12/09
- [elpa] master b7dc61d 59/62: Removed bootstrap.sh, Ian Dunn, 2017/12/09
- [elpa] master b07d853 60/62: Added elpaignore file, Ian Dunn, 2017/12/09
- [elpa] master 5480e97 52/62: Removed obsolete method, Ian Dunn, 2017/12/09
- [elpa] master bc054b8 46/62: Updated info pages, Ian Dunn, 2017/12/09
- [elpa] master 82bd0da 23/62: Fixed various defmethod names to use paced-dictionary- prefix, Ian Dunn, 2017/12/09
- [elpa] master e834a04 47/62: Updated copyright strings in preparation for pushing to GNU ELPA, Ian Dunn, 2017/12/09
- [elpa] master aa2c021 11/62: Added info documentation for future inclusion in ELPA, Ian Dunn, 2017/12/09
- [elpa] master b35b6eb 01/62: Initial import, Ian Dunn, 2017/12/09
- [elpa] master 5b288be 62/62: Add 'packages/paced/' from commit '223809ea68c8d86aef2b61a946d61497125ba250', Ian Dunn, 2017/12/09