[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode be57907 132/346: tests: Make do-one-test never thro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode be57907 132/346: tests: Make do-one-test never throw, always return nil/t |
Date: |
Sun, 29 Aug 2021 11:00:17 -0400 (EDT) |
branch: elpa/d-mode
commit be57907cd3ac84673145b226f67d2bf6a68b543a
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
tests: Make do-one-test never throw, always return nil/t
This makes it easier to handle expected-failures.
---
d-mode-test.el | 51 ++++++++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index 76ab7e2..9c738bd 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -178,37 +178,42 @@
(testbuf (make-test-buffer filename))
(pop-up-windows t)
(linenum 1)
- error-found
+ error-found-p
expectedindent
c-echo-syntactic-information-p)
(switch-to-buffer testbuf)
(syntax-ppss (point-max))
- ;; extract the run command and expected output if any.
- (let* ((contents (buffer-substring-no-properties 1 (point-max)))
- (run-str (if (string-match "^// #run: \\(.+\\)$" contents)
- (match-string 1 contents)))
- (out-str (if (string-match "^// #out: \\(.+\\)$" contents)
- (match-string 1 contents))))
- (when run-str
- (let ((result (eval (car (read-from-string run-str)))))
- (when out-str
- (let ((expect (car (read-from-string out-str))))
- (unless (equal result expect)
- (setq error-found (format "\nExpected: %s\nGot : %s" expect
result))))))))
-
- (when error-found
- (set-buffer testbuf)
- (buffer-enable-undo testbuf)
- (set-buffer-modified-p nil)
-
- (error "Regression found in file %s: %s" filename error-found))
+
+ (condition-case err
+ ;; extract the run command and expected output if any.
+ (let* ((contents (buffer-substring-no-properties 1 (point-max)))
+ (run-str (if (string-match "^// #run: \\(.+\\)$" contents)
+ (match-string 1 contents)))
+ (out-str (if (string-match "^// #out: \\(.+\\)$" contents)
+ (match-string 1 contents))))
+ (when run-str
+ (let ((result (eval (car (read-from-string run-str)))))
+ (when out-str
+ (let ((expect (car (read-from-string out-str))))
+ (unless (equal result expect)
+ (error "\nExpected: %s\nGot : %s" expect result))))))
+ t)
+ (error
+ (set-buffer testbuf)
+ (buffer-enable-undo testbuf)
+ (set-buffer-modified-p nil)
+ (setq error-found-p t)
+
+ (message
+ "Regression found in file %s:\n%s"
+ filename (error-message-string err))))
(set-buffer save-buf)
(goto-char save-point)
- (when (and (not error-found) (interactive-p))
+ (when (and (not error-found-p) (interactive-p))
(kill-test-buffer))
- (not error-found)))
+ (not error-found-p)))
(defun d-test-get-compilation-lines ()
"Get list of line numbers of lines recognized as errors by
`compilation-mode'.
@@ -248,7 +253,7 @@ If the resulting indentation ends up being different, raise
an error."
(c-indent-region (point-min) (point-max)))
(error (concat "Test case has been indented differently.\n"
"Expected:\n--------------------\n%s\n--------------------\n"
- "Got:\n--------------------\n%s\n--------------------\n")
+ "Got:
\n--------------------\n%s\n--------------------\n")
orig (buffer-string))))))
;; Run the tests
- [nongnu] elpa/d-mode 9a89656 102/346: Merge pull request #61 from CyberShadow/pull-20160327-114822, (continued)
- [nongnu] elpa/d-mode 9a89656 102/346: Merge pull request #61 from CyberShadow/pull-20160327-114822, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 7d4d637 101/346: Merge pull request #57 from MartinNowak/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 829e54f 104/346: Merge pull request #63 from CyberShadow/pull-20160328-152643, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 71ab5eb 111/346: Update comments, and rolling release date/time. Add a tag to get a stable release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8d9be09 107/346: Correct README, as per Issue #66., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a967acd 113/346: Correct d-exceptions regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode aba7187 117/346: Merge pull request #69 from CyberShadow/pull-20160611-224824, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 38127d8 125/346: README: Don't use testing branch in shield URLs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 03cd06c 130/346: tests: Add imenu test for 72d2022b606c1ce72bc3e09ecd0679fa057d9496, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3e5a5d5 131/346: tests: Add test case for pull request #35, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode be57907 132/346: tests: Make do-one-test never throw, always return nil/t,
ELPA Syncer <=
- [nongnu] elpa/d-mode 441b866 134/346: tests: Actually test indentation for issue #39, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode baf1669 138/346: tests: Add tests for issue #26., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e81e5f7 147/346: Register our syntax-propertize-function before calling c-common-init, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 739a31e 160/346: Fix imenu for functions with line comments before the body, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e64d5fc 169/346: .travis.yml: Update with emacs-travis compatibility updates, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b5d936d 178/346: Fix imenu hang with unterminated function declaration, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode df1edde 182/346: Fix imenu with extern declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3f34028 185/346: Fix imenu with AtAttributes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b7dc06e 186/346: Fix imenu with function non-template arg list on own line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1ec5880 188/346: Fix another bug related to `-delimited strings, ELPA Syncer, 2021/08/29