[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a5e88b2 34/40: Add test for snippet saving
From: |
Noam Postavsky |
Subject: |
[elpa] master a5e88b2 34/40: Add test for snippet saving |
Date: |
Wed, 26 Oct 2016 23:06:34 +0000 (UTC) |
branch: master
commit a5e88b2fd423791bc9827e48e0c15d69d17ee0b4
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Add test for snippet saving
* yasnippet-tests.el (snippet-save): New test.
---
yasnippet-tests.el | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 55cd137..48d20fa 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -634,6 +634,39 @@ TODO: correct this bug!"
(should (null (key-binding "\C-c1")))
(should (equal (yas-lookup-snippet "won") "one!")))))
+(ert-deftest snippet-save ()
+ "Make sure snippets can be saved correctly."
+ (yas-saving-variables
+ (yas-with-snippet-dirs
+ '((".emacs.d/snippets"
+ ("text-mode")))
+ (letf (((symbol-function 'y-or-n-p) (lambda (&rest _) t))
+ ((symbol-function 'read-file-name)
+ (lambda (_prompt &optional _dir _default _mustmatch initial
_predicate)
+ (expand-file-name initial)))
+ ((symbol-function 'completing-read)
+ (lambda (_prompt collection &rest _)
+ (or (car collection) ""))))
+ (with-temp-buffer
+ (text-mode)
+ (yas-minor-mode +1)
+ (save-current-buffer
+ (yas-new-snippet t)
+ (with-current-buffer "*new snippet*"
+ (snippet-mode)
+ (insert "# name: foo\n# key: bar\n# --\nsnippet foo")
+ (call-interactively 'yas-load-snippet-buffer-and-close)))
+ (save-current-buffer
+ (yas-new-snippet t)
+ (with-current-buffer "*new snippet*"
+ (snippet-mode)
+ (insert "# name: bar\n# key: bar\n# --\nsnippet bar")
+ (call-interactively 'yas-load-snippet-buffer-and-close)))
+ (should (file-readable-p
+ (expand-file-name "foo" (car yas-snippet-dirs))))
+ (should (file-readable-p
+ (expand-file-name "bar" (car yas-snippet-dirs)))))))))
+
(ert-deftest visiting-compiled-snippets ()
"Test snippet visiting for compiled snippets."
(yas-with-some-interesting-snippet-dirs
@@ -1018,7 +1051,7 @@ add the snippets associated with the given mode."
(defun yas-call-with-snippet-dirs (dirs fn)
(let* ((default-directory (make-temp-file "yasnippet-fixture" t))
- (yas-snippet-dirs (mapcar #'car dirs)))
+ (yas-snippet-dirs (mapcar (lambda (d) (expand-file-name (car d)))
dirs)))
(with-temp-message ""
(unwind-protect
(progn
- [elpa] master eaaec30 38/40: Replace all occurances of `capitaomorte', (continued)
- [elpa] master eaaec30 38/40: Replace all occurances of `capitaomorte', Noam Postavsky, 2016/10/26
- [elpa] master ff6f31e 37/40: Replace yas--with-temp-redefs with cl-letf, Noam Postavsky, 2016/10/26
- [elpa] master 244cdfa 26/40: Merge: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 9500b00 21/40: Fix field navigation in the backwards direction, Noam Postavsky, 2016/10/26
- [elpa] master 309fe15 31/40: * Rakefile: Handle unset `warnings' parameter, Noam Postavsky, 2016/10/26
- [elpa] master 9cf9208 32/40: Fix test-rebindings, Noam Postavsky, 2016/10/26
- [elpa] master 7e0a0de 28/40: Use new name of python-in-string/comment in docs, Noam Postavsky, 2016/10/26
- [elpa] master e6b8651 39/40: * NEWS: Update for 0.11.0., Noam Postavsky, 2016/10/26
- [elpa] master 5264379 29/40: Cleanup redundant cl dependency, :group & :require, Noam Postavsky, 2016/10/26
- [elpa] master 4b12f7d 30/40: Don't warn about cl-functions with old cl-lib, Noam Postavsky, 2016/10/26
- [elpa] master a5e88b2 34/40: Add test for snippet saving,
Noam Postavsky <=
- [elpa] master 299efcb 40/40: packages/yasnippet: Merge external (v0.11.0), Noam Postavsky, 2016/10/26