[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ddaf9a9 002/177: Fix: cleanup yasnippet-tests.el
From: |
João Távora |
Subject: |
[elpa] master ddaf9a9 002/177: Fix: cleanup yasnippet-tests.el |
Date: |
Sat, 28 Mar 2015 15:40:23 +0000 |
branch: master
commit ddaf9a9f5c891d68271a5ab0d843570a8afee07d
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Fix: cleanup yasnippet-tests.el
- add edebug-form-specs
- replace "yas/" with "yas-"
- yas/ert => yas-batch-run-tests
---
Rakefile | 2 +-
yasnippet-tests.el | 50 ++++++++++++++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/Rakefile b/Rakefile
index d133218..0d1c43e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -13,7 +13,7 @@ FileUtils.mkdir_p('pkg')
desc "run tests in batch mode"
task :tests do
- sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw --batch -e yas/ert"
+ sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw --batch -e
yas-batch-run-tests"
end
desc "convert some textmate bundles to yasnippets"
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 3bc98f1..ff14702 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -70,7 +70,7 @@
(ert-deftest primary-field-transformation ()
(with-temp-buffer
(yas-minor-mode 1)
- (let ((snippet "${1:$$(upcase yas/text)}${1:$(concat \"bar\" yas/text)}"))
+ (let ((snippet "${1:$$(upcase yas-text)}${1:$(concat \"bar\" yas-text)}"))
(yas-expand-snippet snippet)
(should (string= (yas--buffer-contents) "bar"))
(ert-simulate-command `(yas-mock-insert "foo"))
@@ -172,33 +172,33 @@
(ert-deftest be-careful-when-escaping-in-yas-selected-text ()
(with-temp-buffer
(yas-minor-mode 1)
- (let ((yas/selected-text "He\\\\o world!"))
- (yas-expand-snippet "Look ma! `(yas/selected-text)`")
+ (let ((yas-selected-text "He\\\\o world!"))
+ (yas-expand-snippet "Look ma! `(yas-selected-text)`")
(should (string= (yas--buffer-contents) "Look ma! He\\\\o world!")))
(yas-exit-all-snippets)
(erase-buffer)
- (let ((yas/selected-text "He\"o world!"))
- (yas-expand-snippet "Look ma! `(yas/selected-text)`")
+ (let ((yas-selected-text "He\"o world!"))
+ (yas-expand-snippet "Look ma! `(yas-selected-text)`")
(should (string= (yas--buffer-contents) "Look ma! He\"o world!")))
(yas-exit-all-snippets)
(erase-buffer)
- (let ((yas/selected-text "He\"\)\\o world!"))
- (yas-expand-snippet "Look ma! `(yas/selected-text)`")
+ (let ((yas-selected-text "He\"\)\\o world!"))
+ (yas-expand-snippet "Look ma! `(yas-selected-text)`")
(should (string= (yas--buffer-contents) "Look ma! He\"\)\\o world!")))
(yas-exit-all-snippets)
(erase-buffer)))
(ert-deftest be-careful-when-escaping-in-yas-selected-text-2 ()
(with-temp-buffer
- (let ((yas/selected-text "He)}o world!"))
- (yas-expand-snippet "Look ma! ${1:`(yas/selected-text)`} OK?")
+ (let ((yas-selected-text "He)}o world!"))
+ (yas-expand-snippet "Look ma! ${1:`(yas-selected-text)`} OK?")
(should (string= (yas--buffer-contents) "Look ma! He)}o world! OK?")))))
(ert-deftest example-for-issue-271 ()
(with-temp-buffer
(yas-minor-mode 1)
(let ((yas-selected-text "aaa")
- (snippet "if ${1:condition}\n`yas/selected-text`\nelse\n$3\nend"))
+ (snippet "if ${1:condition}\n`yas-selected-text`\nelse\n$3\nend"))
(yas-expand-snippet snippet)
(yas-next-field)
(ert-simulate-command `(yas-mock-insert "bbb"))
@@ -213,7 +213,7 @@
:passed)
(with-temp-buffer
(yas-minor-mode 1)
- (let ((snippet "\\${${1:1}:`yas/selected-text`}"))
+ (let ((snippet "\\${${1:1}:`yas-selected-text`}"))
(insert "aaabbbccc")
(set-mark 4)
(goto-char 7)
@@ -236,7 +236,7 @@
(yas-minor-mode 1)
;; the rule here is: To use regexps in embedded `(elisp)` expressions,
;; escape backslashes once, i.e. to use \\( \\) constructs, write \\\\(
\\\\).
- (let ((snippet "$1${1:$(if (string-match \"foo\\\\\\\\(ba+r\\\\\\\\)baz\"
yas/text)
+ (let ((snippet "$1${1:$(if (string-match \"foo\\\\\\\\(ba+r\\\\\\\\)baz\"
yas-text)
\"ok\"
\"fail\")}"))
(yas-expand-snippet snippet)
@@ -275,10 +275,10 @@ TODO: correct this bug!"
;; saving all definitions before overriding anything ensures FDEFINITION
;; errors don't cause accidental permanent redefinitions.
;;
- (labels ((set-fdefinitions (names functions)
- (loop for name in names
- for fn in functions
- do (fset name fn))))
+ (cl-flet ((set-fdefinitions (names functions)
+ (loop for name in names
+ for fn in functions
+ do (fset name fn))))
(set-fdefinitions definition-names overriding-functions)
(unwind-protect (funcall function)
(set-fdefinitions definition-names saved-functions)))))
@@ -297,9 +297,6 @@ TODO: correct this bug!"
(lambda ,@(rest thingy))))
fdefinitions)))
-(put 'yas--with-temporary-redefinitions 'lisp-indent-function 1)
-(put 'yas--with-temporary-redefinitions 'edebug-form-spec '((&rest (defun*))
cl-declarations body))
-
(defmacro yas-with-overriden-buffer-list (&rest body)
(let ((saved-sym (make-symbol "yas--buffer-list")))
`(let ((,saved-sym (symbol-function 'buffer-list)))
@@ -545,7 +542,7 @@ TODO: be meaner"
;;; Helpers
;;;
-(defun yas/ert ()
+(defun yas-batch-run-tests ()
(interactive)
(with-temp-buffer
(yas--with-temporary-redefinitions
@@ -644,8 +641,21 @@ TODO: be meaner"
;;; /usr/bin/emacs -nw -Q -L . -l yasnippet-tests.el --batch -e ert
+(put 'yas-saving-variables 'edebug-form-spec t)
+(put 'yas-with-snippet-dirs 'edebug-form-spec t)
+(put 'yas-with-overriden-buffer-list 'edebug-form-spec t)
+(put 'yas-with-some-interesting-snippet-dirs 'edebug-form-spec t)
+
+
+(put 'yas--with-temporary-redefinitions 'lisp-indent-function 1)
+(put 'yas--with-temporary-redefinitions 'edebug-form-spec '((&rest (defun*))
cl-declarations body))
+
+
+
+
(provide 'yasnippet-tests)
;;; yasnippet-tests.el ends here
;; Local Variables:
;; lexical-binding: t
+;; byte-compile-warnings: (not cl-functions)
;; End:
- [elpa] master updated (da45e68 -> 39a27b6), João Távora, 2015/03/28
- [elpa] master 6ce6b24 001/177: fix: replace 'text' in 'yas-text' in bundled snippets, João Távora, 2015/03/28
- [elpa] master ddaf9a9 002/177: Fix: cleanup yasnippet-tests.el,
João Távora <=
- [elpa] master ce50b3d 004/177: Closes #318: Don't use CL-LABELS for backward compatibility with older emacsen, João Távora, 2015/03/28
- [elpa] master a7d40ed 003/177: Closes #318: correctly implement YAS--MODES-TO-ACTIVATE, João Távora, 2015/03/28
- [elpa] master 78c52fd 005/177: fix: shoosh warning with LETREC instead of LET, João Távora, 2015/03/28
- [elpa] master 3ec62ab 006/177: fix: please older emacsen, don't use LETREC after all, João Távora, 2015/03/28
- [elpa] master 1aac5fc 008/177: Merge pull request #407 from dongxiong/patch-1, João Távora, 2015/03/28
- [elpa] master 79f3656 011/177: fix font-lock-keywords syntax, João Távora, 2015/03/28
- [elpa] master 13cfdbc 009/177: fix: remove references to dropdown-list.el in Rakefile, João Távora, 2015/03/28
- [elpa] master 8853127 007/177: Update manual.mdown, João Távora, 2015/03/28
- [elpa] master d963c41 010/177: Closes #406: correct docstring for yas-extra-modes, João Távora, 2015/03/28
- [elpa] master f21ddd1 012/177: remove redundant font-lock-keywords, João Távora, 2015/03/28