[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 43a484e 028/177: add: external test for issue #404
From: |
João Távora |
Subject: |
[elpa] master 43a484e 028/177: add: external test for issue #404 |
Date: |
Sat, 28 Mar 2015 15:40:35 +0000 |
branch: master
commit 43a484e943b7ddceb7def277d259c70bda62a5db
Author: Joao Tavora <address@hidden>
Commit: Joao Tavora <address@hidden>
add: external test for issue #404
---
Rakefile | 4 +++-
yasnippet-tests.el | 44 ++++++++++++++++++++++++++++++++++++++------
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/Rakefile b/Rakefile
index fe25bcc..b7eb238 100644
--- a/Rakefile
+++ b/Rakefile
@@ -13,7 +13,9 @@ 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-batch-run-tests"
+ batch_run_line = "(yas-batch-run-tests t)"
+ sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" +
+ " --batch --eval '#{batch_run_line}'"
end
desc "convert some textmate bundles to yasnippets"
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index fd75063..6147b1d 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -210,9 +210,41 @@
(yas-minor-mode 1)
(insert "#include <foo>\n")
(let ((snippet "main"))
- (yas-expand-snippet snippet)
+ (let ((yas-good-grace nil)) (yas-expand-snippet snippet))
+ (should (string= (yas--buffer-contents) "#include <foo>\nmain")))))
+
+(ert-deftest example-for-issue-404-c-mode ()
+ (with-temp-buffer
+ (c-mode)
+ (yas-minor-mode 1)
+ (insert "#include <foo>\n")
+ (let ((snippet "main"))
+ (let ((yas-good-grace nil)) (yas-expand-snippet snippet))
(should (string= (yas--buffer-contents) "#include <foo>\nmain")))))
+(ert-deftest example-for-issue-404-external-emacs ()
+ :tags '(:external)
+ (let ((fixture-el-file (make-temp-file "yas-404-fixture" nil ".el")))
+ (with-temp-buffer
+ (insert (pp-to-string
+ `(condition-case _
+ (progn
+ (require 'yasnippet)
+ (yas-global-mode)
+ (switch-to-buffer "foo.c")
+ (c-mode)
+ (insert "#include <iostream>\nmain")
+ (setq yas-good-grace nil)
+ (yas-expand)
+ (kill-emacs 0))
+ (error (kill-emacs -1)))))
+ (write-file fixture-el-file))
+ (should (= 0
+ (call-process (concat invocation-directory invocation-name)
+ nil nil nil
+ "-Q" ;; "--batch"
+ "-L" "." "-l" fixture-el-file)))))
+
(ert-deftest middle-of-buffer-snippet-insertion ()
(with-temp-buffer
(yas-minor-mode 1)
@@ -572,14 +604,14 @@ TODO: be meaner"
;;; Helpers
;;;
-(defun yas-batch-run-tests ()
+(defun yas-batch-run-tests (&optional also-external)
(interactive)
(with-temp-buffer
(yas--with-temporary-redefinitions
- ((message (&rest _args) nil))
- (ert t (buffer-name (current-buffer)))
- (princ (buffer-string)))))
-
+ ((message (&rest _args) nil))
+ (ert (or (and also-external t)
+ '(not (tag :external))) (buffer-name (current-buffer)))
+ (princ (buffer-string)))))
(defun yas-should-expand (keys-and-expansions)
(dolist (key-and-expansion keys-and-expansions)
- [elpa] master 5c76a0f 019/177: test middle-of-buffer snippet insertion, (continued)
- [elpa] master 5c76a0f 019/177: test middle-of-buffer snippet insertion, João Távora, 2015/03/28
- [elpa] master 51e9e8e 017/177: wait till after content insertion to narrow, João Távora, 2015/03/28
- [elpa] master 3bb1515 018/177: Merge pull request #409 from npostavs/font-lock, João Távora, 2015/03/28
- [elpa] master 6c3e029 020/177: Merge pull request #412 from npostavs/less-narrow, João Távora, 2015/03/28
- [elpa] master 32ee5cb 021/177: Closes #415: remove c-specific hacks, harmful on emacs 24.3, João Távora, 2015/03/28
- [elpa] master ffd497d 022/177: don't kill snippet buffer unless saved, João Távora, 2015/03/28
- [elpa] master 205b0e6 023/177: move snippet saving from loading to closing, João Távora, 2015/03/28
- [elpa] master 33dff9a 024/177: let C-c C-c save existing snippets too, João Távora, 2015/03/28
- [elpa] master d7b2b89 027/177: widen before deleting regions, João Távora, 2015/03/28
- [elpa] master 84b7e69 025/177: Merge pull request #423 from npostavs/load-snippet-ui, João Távora, 2015/03/28
- [elpa] master 43a484e 028/177: add: external test for issue #404,
João Távora <=
- [elpa] master d5d6e45 026/177: Feature: de/activate-extra-mode, João Távora, 2015/03/28
- [elpa] master 6ee3d2e 029/177: Closes #404: merge remote-tracking branch 'npostavs/widen', João Távora, 2015/03/28
- [elpa] master a4a7e5e 032/177: fix typo: .yas.parents -> .yas-parents, João Távora, 2015/03/28
- [elpa] master fdd550a 035/177: Fix screencast link., João Távora, 2015/03/28
- [elpa] master bc4cfbb 033/177: yas/ -> yas-, João Távora, 2015/03/28
- [elpa] master b20f0a4 034/177: fix exporting of doc strings for org manual, João Távora, 2015/03/28
- [elpa] master f5457df 031/177: Go back to org manual, João Távora, 2015/03/28
- [elpa] master 0f67c07 030/177: Merge pull request #424 from ljos/de/activate-extra-mode, João Távora, 2015/03/28
- [elpa] master 8e8320f 036/177: remove reference to yas-trigger-key, João Távora, 2015/03/28
- [elpa] master 042837d 038/177: Migrate to snippets maintained by the TextMate community, João Távora, 2015/03/28