[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 11cda40 093/346: Merge pull request #48 from dmakar
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 11cda40 093/346: Merge pull request #48 from dmakarov/master |
Date: |
Sun, 29 Aug 2021 11:00:10 -0400 (EDT) |
branch: elpa/d-mode
commit 11cda409268dbe27e95d610b43d4b1382cc00ea0
Merge: 2682220 a927264
Author: Russel Winder <russel@winder.org.uk>
Commit: Russel Winder <russel@winder.org.uk>
Merge pull request #48 from dmakarov/master
Allow tests to specify lisp code and expected output.
---
d-mode-test.el | 55 +++++++++++++++++++++++++------------------------------
tests/I0021.d | 7 ++++---
2 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index 65d8d05..14a41db 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -107,7 +107,7 @@
(c-add-style "teststyle" d-test-teststyle)
-(defun make-test-buffers (filename)
+(defun make-test-buffer (filename)
(let ((testbuf (get-buffer-create "*d-mode-test*"))
(enable-local-eval t))
;; setup the test file buffer.
@@ -121,12 +121,13 @@
(setq buffer-read-only t)
(goto-char (point-min))
(let ((c-default-style "TESTSTYLE")
- d-mode-hook c-mode-common-hook)
+ d-mode-hook
+ c-mode-common-hook)
(d-mode))
(hack-local-variables)
- (list testbuf)))
+ testbuf))
-(defun kill-test-buffers ()
+(defun kill-test-buffer ()
(let (buf)
(if (setq buf (get-buffer "*d-mode-test*"))
(kill-buffer buf))))
@@ -144,8 +145,7 @@
(font-lock-maximum-decoration t)
(font-lock-global-modes nil)
(enable-local-variables ':all)
- (buflist (make-test-buffers filename))
- (testbuf (car buflist))
+ (testbuf (make-test-buffer filename))
(pop-up-windows t)
(linenum 1)
error-found-p
@@ -153,28 +153,21 @@
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)
- (back-to-indentation)
- (setq expectedindent (cons (current-column) expectedindent))
- (unless (eolp)
- ;; Do not reindent empty lines; the test cases might have
- ;; whitespace at eol trimmed away, so that could produce
- ;; false alarms.
- (let ((buffer-read-only nil))
- (if no-error
- (condition-case err (c-indent-line)
- (error
- (unless error-found-p
- (setq error-found-p t)
- (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))
+ (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))))
+ (if run-str
+ (let ((result (eval (car (read-from-string run-str)))))
+ (when out-str
+ (let ((expect (car (read-from-string out-str))))
+ (if (not (equal result expect))
+ (setq error-found-p t)))))))
+
+ (when error-found-p
(set-buffer testbuf)
(buffer-enable-undo testbuf)
(set-buffer-modified-p nil)
@@ -184,11 +177,13 @@
(set-buffer save-buf)
(goto-char save-point)
(when (and (not error-found-p) (interactive-p))
- (kill-test-buffers))
+ (kill-test-buffer))
(not error-found-p)))
;; Run the tests
(ert-deftest d-mode-basic ()
- (should (equal (do-one-test "tests/I0039.d") t)))
+ (should (equal (do-one-test "tests/I0021.d") t))
+ (should (equal (do-one-test "tests/I0039.d") t))
+ )
(provide 'd-mode-test)
diff --git a/tests/I0021.d b/tests/I0021.d
index 090bae6..7d4d92a 100644
--- a/tests/I0021.d
+++ b/tests/I0021.d
@@ -1,3 +1,4 @@
-// #run: (goto-char 74) (c-literal-limits)
-// #out: (72 . 77)
-auto x = `ab\`; // something else
+// #run: (let ((a (progn (goto-char 170) (c-literal-limits))) (b (progn
(goto-char 230) (c-literal-limits)))) (list a b))
+// #out: ((167 . 172) (227 . 232))
+auto x = `ab\`; // back-quoted string ends with a backslash
+auto y = "c\""; // double-quoted string ends with an escaped "
- [nongnu] elpa/d-mode 85a0900 067/346: Update the URL to the D main website., (continued)
- [nongnu] elpa/d-mode 85a0900 067/346: Update the URL to the D main website., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5c5a2b1 071/346: Merge pull request #37 from dmakarov/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e2a1289 074/346: Remove duplicate keywords., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 075c3e7 075/346: Fix indentation of 'else verbose' and 'else debug' statements., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a081749 079/346: Fix clean target., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 4f2994b 082/346: Add more code to the I0039 test., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f184116 084/346: Borrow from cc-mode regression testsuit harness functions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 322250a 088/346: Merge pull request #46 from dmakarov/testing, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ed4ae58 086/346: Add MELPA badge., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2682220 091/346: Merge branch 'dmakarov-master', ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 11cda40 093/346: Merge pull request #48 from dmakarov/master,
ELPA Syncer <=
- [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