[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 63688c6 267/272: Add a couple tests for ivy-read with alis
From: |
Oleh Krehel |
Subject: |
[elpa] master 63688c6 267/272: Add a couple tests for ivy-read with alists |
Date: |
Mon, 25 Apr 2016 10:13:29 +0000 |
branch: master
commit 63688c68872fff0b54e927b765d6a305998a6f91
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add a couple tests for ivy-read with alists
* ivy-test.el (ivy-read): Add tests.
To summarize how it works:
1. Only the keys of the alist are offered for completion, not the values
- this is the standard Emacs behavior.
2. `ivy-read' will return the selected key, not the value or the cons
cell.
3. When :action is specified, it will be called with the value
corresponding to the selected key. Not the key, and not the cons.
This allows keys to work as aliases for the actual data, and :action
arguments to be simple functions that deal with data (i.e. not having to
deal with the `cdr' of the passed argument).
---
ivy-test.el | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/ivy-test.el b/ivy-test.el
index 5e388d3..40dae48 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -79,6 +79,24 @@
"a C-n <tab> C-m")
"aaac"))
(should (equal
+ (ivy-with '(ivy-read "test" '(("foo" . "bar")))
+ "asdf C-m")
+ "asdf"))
+ (should (equal
+ (ivy-with
+ '(with-output-to-string
+ (ivy-read "test" '(("foo" . "bar"))
+ :action (lambda (x) (prin1 x))))
+ "f C-m")
+ "\"bar\""))
+ (should (equal
+ (ivy-with
+ '(with-output-to-string
+ (ivy-read "test" '(("foo" . "bar"))
+ :action (lambda (x) (prin1 x))))
+ "asdf C-m")
+ "\"asdf\""))
+ (should (equal
(ivy-with '(ivy-read "pattern: " '("can do" "can" "can't do"))
"can C-m")
"can")))
- [elpa] master c27cde2 072/272: ivy.el (ivy--reset-state): Don't deactivate region, (continued)
- [elpa] master c27cde2 072/272: ivy.el (ivy--reset-state): Don't deactivate region, Oleh Krehel, 2016/04/25
- [elpa] master a9205fa 232/272: counsel.el (counsel-expression-history): New command, Oleh Krehel, 2016/04/25
- [elpa] master 88169a3 147/272: "C-x C-f" can un-ignore dotfiles with a leading dot input, Oleh Krehel, 2016/04/25
- [elpa] master b4b8d3e 106/272: counsel.el: Organize the file with outlines, Oleh Krehel, 2016/04/25
- [elpa] master 2905d17 153/272: doc/ivy.org: fix typos, Oleh Krehel, 2016/04/25
- [elpa] master 4c81973 181/272: counsel.el (counsel-locate-cmd-es): Fix regex, Oleh Krehel, 2016/04/25
- [elpa] master 591c8fe 167/272: ivy.el (ivy-expand-file-if-directory): Fix "/ssh:" regression, Oleh Krehel, 2016/04/25
- [elpa] master 6817381 068/272: Allow to compose static collections with `counsel--async-command', Oleh Krehel, 2016/04/25
- [elpa] master 212a4b8 098/272: Update the documentation and the manual, Oleh Krehel, 2016/04/25
- [elpa] master b400fcc 108/272: counsel.el: Shuffle functions and rename headings, Oleh Krehel, 2016/04/25
- [elpa] master 63688c6 267/272: Add a couple tests for ivy-read with alists,
Oleh Krehel <=
- [elpa] master cf2c7bc 067/272: Modify "M-n" prediction when region is active, Oleh Krehel, 2016/04/25
- [elpa] master b3f4db7 268/272: ivy.el (ivy--format-minibuffer-line): Update, Oleh Krehel, 2016/04/25
- [elpa] master e9e8ec0 112/272: counsel.el: Shuffle functions, Oleh Krehel, 2016/04/25
- [elpa] master d7561d2 203/272: counsel.el: Reduce counsel-grep char req to 2, Oleh Krehel, 2016/04/25
- [elpa] master 94a7b0f 140/272: * ivy.el (ivy-format-function-line): Remove `extra' parameter., Oleh Krehel, 2016/04/25
- [elpa] master bf7d95f 143/272: Move read-file-name to :display-transformer-fn, Oleh Krehel, 2016/04/25
- [elpa] master 80825a6 082/272: ivy.el: Fixup face docs, Oleh Krehel, 2016/04/25
- [elpa] master 44856a3 219/272: ivy.el (ivy-read): Revert abf880f, Oleh Krehel, 2016/04/25
- [elpa] master 0afb000 077/272: Fix default-directory for ivy-occur + counsel-git-grep, Oleh Krehel, 2016/04/25
- [elpa] master a6cd189 192/272: counsel.el (counsel-linux-apps-list): Skip spaces around =, Oleh Krehel, 2016/04/25