[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master def5466 8/8: ; * test/lisp/cedet/semantic/format-tests.el: Minor
From: |
Stefan Kangas |
Subject: |
master def5466 8/8: ; * test/lisp/cedet/semantic/format-tests.el: Minor cleanup. |
Date: |
Wed, 10 Feb 2021 00:45:44 -0500 (EST) |
branch: master
commit def546679fd93a4a1d049d9d3021166bf66a0e26
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
; * test/lisp/cedet/semantic/format-tests.el: Minor cleanup.
---
test/lisp/cedet/semantic/format-tests.el | 108 +++++++++++++------------------
1 file changed, 46 insertions(+), 62 deletions(-)
diff --git a/test/lisp/cedet/semantic/format-tests.el
b/test/lisp/cedet/semantic/format-tests.el
index a9eb448..e82c97b 100644
--- a/test/lisp/cedet/semantic/format-tests.el
+++ b/test/lisp/cedet/semantic/format-tests.el
@@ -20,7 +20,7 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
-;;
+
;; Unit tests for the formatting feature.
;;
;; Using test code from the tests source directory, parse the source
@@ -40,71 +40,55 @@
)
"List of files to run unit tests in.")
-(defvar semantic-fmt-utest-error-log-list nil
- "Log errors during testing in this variable.")
-
(ert-deftest semantic-fmt-utest ()
- "Visit all file entries, and run formatting test.
-Files to visit are in `semantic-fmt-utest-file-list'."
+ "Visit all file entries, and run formatting test. "
(save-current-buffer
(semantic-mode 1)
- (let ((fl semantic-fmt-utest-file-list))
- (dolist (fname fl)
+ (dolist (fname semantic-fmt-utest-file-list)
+ (let ((fb (find-buffer-visiting fname))
+ (b (semantic-find-file-noselect fname))
+ (tags nil))
(save-current-buffer
- (let ((fb (find-buffer-visiting fname))
- (b (semantic-find-file-noselect fname))
- (tags nil))
-
- (save-current-buffer
- (set-buffer b)
- (should (semantic-active-p))
- ;;(error "Cannot open %s for format tests" fname))
-
- ;; This will force a reparse, removing any chance of semanticdb
cache
- ;; using stale data.
- (semantic-clear-toplevel-cache)
- ;; Force the reparse
- (setq tags (semantic-fetch-tags))
-
- (save-excursion
- (while tags
- (let* ((T (car tags))
- (start (semantic-tag-end T))
- (end (if (cdr tags)
- (semantic-tag-start (car (cdr tags)))
- (point-max)))
- (TESTS nil)
- )
- (goto-char start)
- ;; Scan the space between tags for all test condition
matches.
- (while (re-search-forward "## \\([a-z-]+\\)
\"\\([^\n\"]+\\)\"$" end t)
- (push (cons (match-string 1) (match-string 2)) TESTS))
- (setq TESTS (nreverse TESTS))
-
- (dolist (TST TESTS)
- (let* ( ;; For each test, convert CAR into a
semantic-format-tag* fcn
- (sym (intern (concat "semantic-format-tag-" (car
TST))))
- ;; Convert the desired result from a string syntax
to a string.
- (desired (cdr TST))
- ;; What does the fmt function do?
- (actual (funcall sym T))
- )
- (when (not (string= desired actual))
- (should-not (list "Desired" desired
- "Actual" actual
- "Formatter" (car TST))))
- )))
- (setq tags (cdr tags)))
-
- ))
-
- ;; If it wasn't already in memory, whack it.
- (when (and b (not fb))
- (kill-buffer b)))
- ))
-
- )))
-
+ (set-buffer b)
+ (should (semantic-active-p))
+ ;;(error "Cannot open %s for format tests" fname))
+
+ ;; This will force a reparse, removing any chance of semanticdb cache
+ ;; using stale data.
+ (semantic-clear-toplevel-cache)
+ ;; Force the reparse
+ (setq tags (semantic-fetch-tags))
+
+ (save-excursion
+ (while tags
+ (let* ((T (car tags))
+ (start (semantic-tag-end T))
+ (end (if (cdr tags)
+ (semantic-tag-start (car (cdr tags)))
+ (point-max)))
+ (TESTS nil))
+ (goto-char start)
+ ;; Scan the space between tags for all test condition matches.
+ (while (re-search-forward "## \\([a-z-]+\\)
\"\\([^\n\"]+\\)\"$" end t)
+ (push (cons (match-string 1) (match-string 2)) TESTS))
+ (setq TESTS (nreverse TESTS))
+
+ (dolist (TST TESTS)
+ (let* ( ;; For each test, convert CAR into a
semantic-format-tag* fcn
+ (sym (intern (concat "semantic-format-tag-" (car
TST))))
+ ;; Convert the desired result from a string syntax to
a string.
+ (desired (cdr TST))
+ ;; What does the fmt function do?
+ (actual (funcall sym T)))
+ (when (not (string= desired actual))
+ (should-not (list "Desired" desired
+ "Actual" actual
+ "Formatter" (car TST)))))))
+ (setq tags (cdr tags)))))
+
+ ;; If it wasn't already in memory, whack it.
+ (when (and b (not fb))
+ (kill-buffer b))))))
(provide 'format-tests)
- master updated (ff16c89 -> def5466), Stefan Kangas, 2021/02/10
- master 843ca06 2/8: Convert many manual cedet tests to ert, Stefan Kangas, 2021/02/10
- master a0451be 1/8: Use lexical-binding in almost all of play/*.el, Stefan Kangas, 2021/02/10
- master 45934e5 3/8: Change default semantic-lex-analyzer to semantic-lex, Stefan Kangas, 2021/02/10
- master 18ad138 4/8: Use lexical-binding in some test files, Stefan Kangas, 2021/02/10
- master c07459f 5/8: Move semantic/format.el tests to follow our conventions, Stefan Kangas, 2021/02/10
- master f0f5480 6/8: Use lexical-binding in bib-mode.el, Stefan Kangas, 2021/02/10
- master def5466 8/8: ; * test/lisp/cedet/semantic/format-tests.el: Minor cleanup.,
Stefan Kangas <=
- master c735ec9 7/8: Make texinfmt-version variable obsolete, Stefan Kangas, 2021/02/10