[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode ae32e1c28f 193/222: Use ‘insert-file-cont
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode ae32e1c28f 193/222: Use ‘insert-file-contents’ instead of ‘find-file’ for tests. |
Date: |
Sun, 6 Feb 2022 16:59:32 -0500 (EST) |
branch: elpa/typescript-mode
commit ae32e1c28f6dfb4ea2e56c770e4c944f0ee247f2
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>
Use ‘insert-file-contents’ instead of ‘find-file’ for tests.
‘find-file’ doesn’t signal errors if visiting the file failed and is
therefore
more brittle. Also it makes the file buffer readonly if the visited file is
readonly, causing tests to fail if the testfiles are readonly.
---
typescript-mode-general-tests.el | 52 ++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index d9def0a2f6..3ccdb0539f 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -19,7 +19,8 @@
(untabify (point-min) (point-max)))
(ert-deftest indentation-reference-document-is-reflowed-correctly ()
- (let ((buffer (find-file "test-files/indentation-reference-document.ts")))
+ (with-temp-buffer
+ (insert-file-contents "test-files/indentation-reference-document.ts")
;; double ensure mode is active
(typescript-mode)
@@ -30,61 +31,60 @@
(let ((typescript-indent-switch-clauses nil))
(typescript-test-indent-all)
(should (string-equal test-reference
- (typescript-test-get-doc)))))
- (kill-buffer buffer)))
+ (typescript-test-get-doc)))))))
(ert-deftest switch-case-indent-default ()
- (let ((buffer (find-file "test-files/switch-case-indent-default.ts")))
+ (with-temp-buffer
+ (insert-file-contents "test-files/switch-case-indent-default.ts")
(typescript-mode)
(let ((test-reference (typescript-test-get-doc)))
(typescript-test-indent-all)
(should (string-equal test-reference
- (typescript-test-get-doc))))
- (kill-buffer buffer)))
+ (typescript-test-get-doc))))))
(ert-deftest switch-case-indent-disabled ()
- (let ((buffer (find-file "test-files/switch-case-indent-disabled.ts"))
- (typescript-indent-switch-clauses nil))
- (typescript-mode)
- (let ((test-reference (typescript-test-get-doc)))
- (typescript-test-indent-all)
- (should (string-equal test-reference
- (typescript-test-get-doc))))
- (kill-buffer buffer)))
+ (with-temp-buffer
+ (insert-file-contents "test-files/switch-case-indent-disabled.ts")
+ (let ((typescript-indent-switch-clauses nil))
+ (typescript-mode)
+ (let ((test-reference (typescript-test-get-doc)))
+ (typescript-test-indent-all)
+ (should (string-equal test-reference
+ (typescript-test-get-doc)))))))
(ert-deftest list-items-indent-default ()
- (with-current-buffer (find-file "test-files/list-items-indent-default.ts")
+ (with-temp-buffer
+ (insert-file-contents "test-files/list-items-indent-default.ts")
(typescript-mode)
(let ((test-reference (typescript-test-get-doc)))
(typescript-test-indent-all)
- (should (string= test-reference (typescript-test-get-doc))))
- (kill-buffer)))
+ (should (string= test-reference (typescript-test-get-doc))))))
(ert-deftest list-items-indent-default-not-comma-first ()
- (with-current-buffer (find-file
"test-files/list-items-indent-comma-first.ts")
+ (with-temp-buffer
+ (insert-file-contents "test-files/list-items-indent-comma-first.ts")
(typescript-mode)
(let ((test-reference (typescript-test-get-doc)))
(typescript-test-indent-all)
- (should-not (string= test-reference (typescript-test-get-doc))))
- (kill-buffer)))
+ (should-not (string= test-reference (typescript-test-get-doc))))))
(ert-deftest list-items-indent-comma-first ()
- (with-current-buffer (find-file
"test-files/list-items-indent-comma-first.ts")
+ (with-temp-buffer
+ (insert-file-contents "test-files/list-items-indent-comma-first.ts")
(typescript-mode)
(let ((test-reference (typescript-test-get-doc))
(typescript-indent-list-items nil))
(typescript-test-indent-all)
- (should (string= test-reference (typescript-test-get-doc))))
- (kill-buffer)))
+ (should (string= test-reference (typescript-test-get-doc))))))
(ert-deftest list-items-indent-comma-first-not-default ()
- (with-current-buffer (find-file "test-files/list-items-indent-default.ts")
+ (with-temp-buffer
+ (insert-file-contents "test-files/list-items-indent-default.ts")
(typescript-mode)
(let ((test-reference (typescript-test-get-doc))
(typescript-indent-list-items nil))
(typescript-test-indent-all)
- (should-not (string= test-reference (typescript-test-get-doc))))
- (kill-buffer)))
+ (should-not (string= test-reference (typescript-test-get-doc))))))
(defun get-all-matched-strings (to-match)
(let (result)
- [nongnu] elpa/typescript-mode 526f307ca8 101/222: Fontify yield and yield* as keyword, (continued)
- [nongnu] elpa/typescript-mode 526f307ca8 101/222: Fontify yield and yield* as keyword, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 67d67f0c20 099/222: Typo in the readme, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode b5e3f2a8a6 100/222: Merge pull request #68 from GeertVL/patch-1, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode a5f342e539 160/222: Add snake_cased function call to regression test suite, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 6eaddf6c17 162/222: Drop the custom insert-and-indent code in favor of electric-indent., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 0fc7297870 184/222: Add compilation-mode support for ng lint too., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode b6cd68ae77 177/222: Add test-cases for type-highlights supported so far., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 102587e458 183/222: Merge pull request #132 from jkdufair/master, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode e6f68ab2dd 198/222: Fontify basic types over keywords., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode fb44319479 197/222: Merge pull request #125 from Fuco1/fix/prefer-constant-over-keyword, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode ae32e1c28f 193/222: Use ‘insert-file-contents’ instead of ‘find-file’ for tests.,
ELPA Syncer <=
- [nongnu] elpa/typescript-mode bbbe50aade 194/222: Merge pull request #140 from phst/find-file, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 996fb729ca 201/222: Update README.md, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode c9b22f5f33 215/222: Merge pull request #152 from Rogach/pr/fix-indentation-when-lexical-scoping, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 47b7fd239e 214/222: add a test for error thrown if typescript-mode is loaded with lexical scoping enabled, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 49ff1149e2 218/222: Add `override` to the list of highlighted keywords, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 36f685251f 008/222: Merge pull request #2 from quanticle/master, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 5a3c84247d 007/222: Typescript added the "protected" keyword in 1.3., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 49241bcc1f 011/222: Merge pull request #3 from OrangeShark/typescript1.5, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode ad8f356cbe 021/222: Merge pull request #15 from valerian/bool, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 39827549ef 017/222: Merge pull request #13 from wingyplus/highlight-set-and-get-keyword, ELPA Syncer, 2022/02/06