[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 79940f2 085/346: Cleanup and fix test error reporti
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 79940f2 085/346: Cleanup and fix test error reporting. |
Date: |
Sun, 29 Aug 2021 11:00:08 -0400 (EDT) |
branch: elpa/d-mode
commit 79940f2fa404c2b76b6089079c28da56bf889daf
Author: Dmitri Makarov <dmakarov@alumni.stanford.edu>
Commit: Dmitri Makarov <dmakarov@alumni.stanford.edu>
Cleanup and fix test error reporting.
---
d-mode-test.el | 79 ++++++++++++++++++++++++----------------------------------
1 file changed, 32 insertions(+), 47 deletions(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index 8b1a793..65d8d05 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -25,24 +25,21 @@
(require 'd-mode nil t)
(defconst d-test-teststyle
- '((c-tab-always-indent . t)
- (c-basic-offset . 4)
- (c-comment-only-line-offset . 0)
- (c-comment-prefix-regexp . "\\(//+\\|\\**\\)[.!|]?")
- (c-hanging-braces-alist . ((block-open after)
- (brace-list-open)
- (substatement-open after)
- (inexpr-class-open after)
- (inexpr-class-close before)
- ))
- (c-hanging-colons-alist . ((member-init-intro before)
- (inher-intro)
- (case-label after)
- (label after)
- (access-key after)))
- (c-cleanup-list . (scope-operator
- empty-defun-braces
- defun-close-semi))
+ '((c-tab-always-indent . t)
+ (c-basic-offset . 2)
+ (c-comment-only-line-offset . 0)
+ (c-comment-prefix-regexp . "\\(//+\\|\\**\\)[.!|]?")
+ (c-hanging-braces-alist . ((block-open after)
+ (brace-list-open)
+ (substatement-open after)
+ (inexpr-class-open after)
+ (inexpr-class-close before)))
+ (c-hanging-colons-alist . ((member-init-intro before)
+ (inher-intro)
+ (case-label after)
+ (label after)
+ (access-key after)))
+ (c-cleanup-list . (scope-operator empty-defun-braces defun-close-semi))
(c-offsets-alist
. ((string . c-lineup-dont-change)
(c . c-lineup-C-comments)
@@ -54,8 +51,6 @@
(inline-open . 0)
(inline-close . 0)
(func-decl-cont . +)
- (knr-argdecl-intro . +)
- (knr-argdecl . 0)
(topmost-intro . 0)
(topmost-intro-cont . c-lineup-topmost-intro-cont)
(member-init-intro . +)
@@ -89,13 +84,6 @@
(arglist-close . +)
(stream-op . c-lineup-streamop)
(inclass . +)
- (cpp-macro . [0])
- (cpp-macro-cont . +)
- (cpp-define-intro . (c-lineup-cpp-define +))
- (friend . 0)
- (objc-method-intro . [0])
- (objc-method-args-cont . c-lineup-ObjC-method-args)
- (objc-method-call-cont . c-lineup-ObjC-method-call)
(extern-lang-open . 0)
(extern-lang-close . 0)
(inextern-lang . +)
@@ -112,11 +100,9 @@
(inlambda . c-lineup-inexpr-block)
(lambda-intro-cont . +)
(inexpr-statement . +)
- (inexpr-class . +)
- ))
+ (inexpr-class . +)))
(c-echo-syntactic-information-p . t)
- (c-indent-comment-alist . nil)
- )
+ (c-indent-comment-alist . nil))
"Style for testing.")
(c-add-style "teststyle" d-test-teststyle)
@@ -131,7 +117,8 @@
(setq buffer-read-only nil)
(erase-buffer)
(insert-file-contents filename)
- (setq buffer-read-only t) ; test that we make no (hidden) changes.
+ ;; test that we make no (hidden) changes.
+ (setq buffer-read-only t)
(goto-char (point-min))
(let ((c-default-style "TESTSTYLE")
d-mode-hook c-mode-common-hook)
@@ -144,9 +131,14 @@
(if (setq buf (get-buffer "*d-mode-test*"))
(kill-buffer buf))))
+(defun d-test-message (msg &rest args)
+ (if noninteractive
+ (send-string-to-terminal
+ (concat (apply 'format msg args) "\n"))
+ (apply 'message msg args)))
+
(defun do-one-test (filename)
(interactive "fFile to test: ")
-
(let* ((save-buf (current-buffer))
(save-point (point))
(font-lock-maximum-decoration t)
@@ -156,15 +148,11 @@
(testbuf (car buflist))
(pop-up-windows t)
(linenum 1)
- test-error-found
error-found-p
expectedindent
- c-echo-syntactic-information-p
- font-lock-verbose
- last-result)
+ c-echo-syntactic-information-p)
(switch-to-buffer testbuf)
-
;; Record the expected indentation and reindent. This is done
;; in backward direction to avoid cascading errors.
(while (= (forward-line -1) 0)
@@ -176,18 +164,14 @@
;; false alarms.
(let ((buffer-read-only nil))
(if no-error
- (condition-case err
- (c-indent-line)
+ (condition-case err (c-indent-line)
(error
(unless error-found-p
(setq error-found-p t)
- (cc-test-log
- "%s:%d: c-indent-line error: %s"
- filename (1+ (count-lines (point-min) (c-point 'bol)))
- (error-message-string err))
- (when cc-test-last-backtrace
- (cc-test-log "%s" cc-test-last-backtrace)
- (setq cc-test-last-backtrace nil)))))
+ (d-test-message
+ "%s:%d: c-indent-line error: %s" filename
+ (1+ (count-lines (point-min) (c-point 'bol)))
+ (error-message-string err)))))
(c-indent-line)))))
(when (and error-found-p (not no-error))
@@ -203,6 +187,7 @@
(kill-test-buffers))
(not error-found-p)))
+;; Run the tests
(ert-deftest d-mode-basic ()
(should (equal (do-one-test "tests/I0039.d") t)))
- [nongnu] elpa/d-mode 29589e6 064/346: Line after 'else' should not be a statment-cont, (continued)
- [nongnu] elpa/d-mode 29589e6 064/346: Line after 'else' should not be a statment-cont, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 281ea8f 020/346: Add 'delete' to c-paren-type-kwds., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 9b22a93 023/346: Declare the 2.0.6 release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2cb1fe0 030/346: don't highlight []* in type face, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2f684db 037/346: Fix deadlock in imenu generator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 701c6be 044/346: use `cc-imenu-init' rather than `setq', ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode bac805f 050/346: Fix backslashes in backquotes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 86930c3 059/346: Rework a sentence of the README., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5691b70 069/346: Merge pull request #36 from dmakarov/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8a14ce4 080/346: Fix some compiler warnings., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 79940f2 085/346: Cleanup and fix test error reporting.,
ELPA Syncer <=
- [nongnu] elpa/d-mode fbd1f8b 089/346: Merge pull request #44 from snosov1/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e19d704 090/346: Closes #21., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a927264 092/346: Allow tests to specify lisp code and expected output., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b4cbdfc 094/346: Workaround issue #50., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3e80976 097/346: recognize deprecation warnings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 6323cd4 098/346: Recognize postfix @-keywords in function declarations for imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 600c70b 108/346: Merge pull request #65 from CyberShadow/pull-20160329-054927, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3e73378 112/346: Update the badges/shields in the README., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a99d127 054/346: Fix keywords list construction to include doc-comment keywords., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f487a71 058/346: Add the function to support alignment of multi-line fluent API using expressions., ELPA Syncer, 2021/08/29