[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode e52434e 218/346: d-mode-test.el: Save actual result
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode e52434e 218/346: d-mode-test.el: Save actual result to file in case of mismatch |
Date: |
Sun, 29 Aug 2021 11:00:34 -0400 (EDT) |
branch: elpa/d-mode
commit e52434ed465b14cc5b54c8bee7b62a9f39c4e95d
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
d-mode-test.el: Save actual result to file in case of mismatch
---
.gitignore | 1 +
Makefile | 1 +
d-mode-test.el | 18 ++++++++++++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1304fa2..9e02930 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.elc
/.cask/
+/tests/*.res.*
diff --git a/Makefile b/Makefile
index a51239f..6455f89 100644
--- a/Makefile
+++ b/Makefile
@@ -9,5 +9,6 @@ compile:
clean:
rm -f d-mode.elc
+ find tests -name '*.res.*' -delete
.PHONY: all test
diff --git a/d-mode-test.el b/d-mode-test.el
index 0616251..a5b98a7 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -253,6 +253,17 @@ Called from the #run snippet of individual test files."
imenu--index-alist))
'<))
+(defun d-test-save-result (filename)
+ "In case of an unexpected result, save it to a file.
+
+FILENAME is the original (versioned) file name."
+ (write-region
+ nil nil
+ (concat
+ (file-name-sans-extension filename)
+ ".res"
+ (file-name-extension filename t))))
+
(defun d-test-indent ()
"Re-indent the current file.
@@ -262,7 +273,8 @@ If the resulting indentation ends up being different, raise
an error."
(error
(let ((orig (buffer-string)))
(let (buffer-read-only)
- (c-indent-region (point-min) (point-max)))
+ (c-indent-region (point-min) (point-max))
+ (d-test-save-result (buffer-file-name)))
(error (concat "Test case has been indented differently.\n"
"Expected:\n--------------------\n%s\n--------------------\n"
"Got:
\n--------------------\n%s\n--------------------\n")
@@ -282,11 +294,13 @@ the reference file, raise an error."
(default-value 'font-lock-fontify-region-function)))
(let* ((hfy-optimisations '(body-text-only merge-adjacent-tags))
+ (html-filename (concat filename ".html"))
(actual (with-current-buffer (htmlfontify-buffer nil "test.d")
(buffer-string)))
(expected (with-temp-buffer
- (insert-file-contents (concat filename ".html"))
+ (insert-file-contents html-filename)
(buffer-string))))
(unless (equal actual expected)
+ (with-temp-buffer (insert actual) (d-test-save-result html-filename))
(error (concat "Test case has been fontified differently.\n"
"Expected:\n--------------------\n%s\n--------------------\n"
"Got:
\n--------------------\n%s\n--------------------\n")
- [nongnu] elpa/d-mode e809bd1 181/346: Fix imenu with conditional non-function declarations, (continued)
- [nongnu] elpa/d-mode e809bd1 181/346: Fix imenu with conditional non-function declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5e08129 192/346: Fix indentation of function out contracts, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 06fb0ff 189/346: Fix indentation of enums with a base type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1afddc7 190/346: Fix a typo in a regex, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 382a677 195/346: Use c-major-mode-is, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 9edcfbd 197/346: Remove unused bits from d-in-knr-argdecl, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 175c6e5 193/346: Fix indentation of function constraints/contracts?, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5fdba4e 202/346: Add pragma keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 51b1af1 203/346: Fix K&R region detection and body-less function declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b5fb492 204/346: Fix fontification of manifest (enum) constants, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e52434e 218/346: d-mode-test.el: Save actual result to file in case of mismatch,
ELPA Syncer <=
- [nongnu] elpa/d-mode 609816b 219/346: tests: Move d-forward-type tests to new test file, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 4d9f9ce 211/346: Drop support for Emacs 24, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f2b4aec 205/346: Fix fontification of "a in b" expressions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f69e94e 207/346: Change test suite enumeration and activation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b0a59de 214/346: Fix mis-parsing of concatenating two variables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 445c696 210/346: Implement a more complete description for D type syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ed0de34 222/346: Refactor "this" (constructor) handling, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode aaa704a 216/346: Fix coverage issues in d-forward-type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 572d707 221/346: Improve comprehension of constness and storage classes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 64afe5f 206/346: .travis.yml: Test against more Emacs versions, ELPA Syncer, 2021/08/29