[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 588dab6 49/67: ivy-test.el: Add testing
From: |
Oleh Krehel |
Subject: |
[elpa] master 588dab6 49/67: ivy-test.el: Add testing |
Date: |
Sun, 22 Mar 2015 17:34:07 +0000 |
branch: master
commit 588dab6cb5ed0c42ff3436311a8d9f831a29724b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy-test.el: Add testing
* Makefile: Add a test and compile target.
---
.travis.yml | 12 ++++++++++++
Makefile | 16 ++++++++++++++++
ivy-test.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1f5dbc7
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+language: emacs-lisp
+env:
+ matrix:
+ - EMACS=emacs24
+
+before_install:
+ - sudo add-apt-repository -y ppa:cassou/emacs
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq $EMACS
+
+script:
+ - make test
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..453f709
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+emacs ?= emacs
+
+LOAD = -l ivy.el -l swiper.el
+
+.PHONY: all compile clean
+
+all: test
+
+test:
+ $(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
+
+compile:
+ $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\"
\"swiper.el\"))"
+
+clean:
+ rm -f *.elc
diff --git a/ivy-test.el b/ivy-test.el
new file mode 100644
index 0000000..af17414
--- /dev/null
+++ b/ivy-test.el
@@ -0,0 +1,46 @@
+(require 'ert)
+
+(defvar ivy-expr nil
+ "Holds a test expression to evaluate with `ivy-eval'.")
+
+(defvar ivy-result nil
+ "Holds the eval result of `ivy-expr' by `ivy-eval'.")
+
+(defun ivy-eval ()
+ "Evaluate `ivy-expr'."
+ (interactive)
+ (setq ivy-result (eval ivy-expr)))
+
+(global-set-key (kbd "C-c e") 'ivy-eval)
+
+(defun ivy-with (expr keys)
+ "Evaluate EXPR followed by KEYS."
+ (let ((ivy-expr expr))
+ (execute-kbd-macro
+ (vconcat (kbd "C-c e")
+ (kbd keys)))
+ ivy-result))
+
+(ert-deftest ivy-read ()
+ (should (equal
+ (ivy-read "pattern: " nil)
+ nil))
+ (should (equal
+ (ivy-read "pattern: " '("42"))
+ "42"))
+ (should (equal
+ (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
+ "C-m")
+ "blue"))
+ (should (equal
+ (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
+ "y C-m")
+ "yellow"))
+ (should (equal
+ (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
+ "y DEL b C-m")
+ "blue"))
+ (should (equal
+ (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
+ "z C-m")
+ nil)))
- [elpa] master 8818a01 36/67: swiper.el: Fix error for empty buffer, (continued)
- [elpa] master 8818a01 36/67: swiper.el: Fix error for empty buffer, Oleh Krehel, 2015/03/22
- [elpa] master 984346c 40/67: swiper.el (swiper-font-lock-ensure): Exclude a few modes, Oleh Krehel, 2015/03/22
- [elpa] master cb26121 41/67: ivy.el: Fix ivy-history recording the full text instead of input, Oleh Krehel, 2015/03/22
- [elpa] master de80846 39/67: Work around magit highlighting problem, Oleh Krehel, 2015/03/22
- [elpa] master 7bb5320 42/67: swiper.el (swiper--helm): Require helm-match-plugin, Oleh Krehel, 2015/03/22
- [elpa] master caa69f2 43/67: counsel.el: Add git file completion, Oleh Krehel, 2015/03/22
- [elpa] master fcb18e5 44/67: ivy.el (ivy-read): Bring last history candidate to front, Oleh Krehel, 2015/03/22
- [elpa] master e32bc63 46/67: swiper.el: Fix non-matching lines issue with initial-input, Oleh Krehel, 2015/03/22
- [elpa] master f1672c7 45/67: Add isearch-like history behavior, Oleh Krehel, 2015/03/22
- [elpa] master 41732be 48/67: ivy.el: Return nil when there is no match, Oleh Krehel, 2015/03/22
- [elpa] master 588dab6 49/67: ivy-test.el: Add testing,
Oleh Krehel <=
- [elpa] master f754835 47/67: swiper.el: Silence a few compilation warnings, Oleh Krehel, 2015/03/22
- [elpa] master cc4bf75 52/67: README.md: Add build status, Oleh Krehel, 2015/03/22
- [elpa] master 2b8e4e1 53/67: ivy.el: Remove while-no-input, Oleh Krehel, 2015/03/22
- [elpa] master 2191bdb 54/67: ivy.el (ivy-completions): Simplify, Oleh Krehel, 2015/03/22
- [elpa] master d587fa2 51/67: ivy.el (ivy-read): Allow for format-style PROMPT, Oleh Krehel, 2015/03/22
- [elpa] master 9f9c4dc 57/67: swiper-helm.el: Fix typo, Oleh Krehel, 2015/03/22
- [elpa] master 3a08a88 50/67: ivy.el (ivy-read): Change index to preselect, Oleh Krehel, 2015/03/22
- [elpa] master d2b2813 55/67: swiper-helm.el: Copy all helm stuff here, Oleh Krehel, 2015/03/22
- [elpa] master c4acef9 56/67: swiper.el: Remove the helm bits, Oleh Krehel, 2015/03/22
- [elpa] master 0c85d9a 58/67: Add a custom `ivy-count-format', Oleh Krehel, 2015/03/22