[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 07f0358 392/439: Add test case operator !!> for ex
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 07f0358 392/439: Add test case operator !!> for expected errors |
Date: |
Tue, 04 Aug 2015 20:31:05 +0000 |
branch: externals/dash
commit 07f03588620e0ff81bb3d4e44c7224e9a44ffc02
Author: Fredrik Bergroth <address@hidden>
Commit: Fredrik Bergroth <address@hidden>
Add test case operator !!> for expected errors
---
dev/examples-to-tests.el | 9 ++++++---
dev/examples.el | 11 +++--------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/dev/examples-to-tests.el b/dev/examples-to-tests.el
index 6cee1a3..70c5ae7 100644
--- a/dev/examples-to-tests.el
+++ b/dev/examples-to-tests.el
@@ -3,9 +3,12 @@
(require 'dash-functional)
(defun example-to-should (example)
- (let ((actual (car example))
- (expected (nth 2 example)))
- `(should (equal ,actual ,expected))))
+ (-let [(actual sym expected) example]
+ (cond
+ ((eq sym '=>)
+ `(should (equal ,actual ,expected)))
+ ((eq sym '!!>)
+ `(should-error (eval ',actual) :type ',expected)))))
(defmacro defexamples (cmd &rest examples)
`(ert-deftest ,cmd ()
diff --git a/dev/examples.el b/dev/examples.el
index 7e25d16..acac497 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -739,12 +739,7 @@ new list."
(-let [[a b &rest [c d]] [1 2 3 4 5 6]] (list a b c d)) => '(1 2 3 4)
;; here we error, because "vectors" are rigid, immutable structures,
;; so we should know how many elements there are
- (condition-case nil
- (-let [[a b c d] [1 2 3]]
- (progn
- (list a b c d)
- (error "previous call should fail.")))
- (args-out-of-range t)) => t
+ (-let [[a b c d] [1 2 3]] t) !!> args-out-of-range
(-let [(a . (b . c)) (cons 1 (cons 2 3))] (list a b c)) => '(1 2 3)
(-let [(_ _ . [a b]) (cons 1 (cons 2 (vector 3 4)))] (list a b)) => '(3 4)
(-let [(_ _ . (a b)) (cons 1 (cons 2 (list 3 4)))] (list a b)) => '(3 4)
@@ -838,7 +833,7 @@ new list."
(-map (-lambda ((&plist :a a :b b)) (+ a b)) '((:a 1 :b 2) (:a 3 :b 4) (:a
5 :b 6))) => '(3 7 11)
(-map (-lambda (x) (let ((k (car x)) (v (cadr x))) (+ k v))) '((1 2) (3 4)
(5 6))) => '(3 7 11)
(funcall (-lambda ((a) (b)) (+ a b)) '(1 2 3) '(4 5 6)) => 5
- (condition-case nil (progn (-lambda a t) (error "previous form should
error")) (wrong-type-argument t)) => t
+ (-lambda a t) !!> wrong-type-argument
(funcall (-lambda (a b) (+ a b)) 1 2) => 3
(funcall (-lambda (a (b c)) (+ a b c)) 1 (list 2 3)) => 6))
@@ -983,5 +978,5 @@ new list."
))
;; Local Variables:
-;; eval: (font-lock-add-keywords nil '(("defexamples\\|def-example-group\\| =>
" (0 'font-lock-keyword-face)) ("(defexamples[[:blank:]]+\\(.*\\)" (1
'font-lock-function-name-face))))
+;; eval: (font-lock-add-keywords nil '(("defexamples\\|def-example-group\\| =>
\\| !!> " (0 'font-lock-keyword-face)) ("(defexamples[[:blank:]]+\\(.*\\)" (1
'font-lock-function-name-face))))
;; End:
- [elpa] externals/dash 5f879b3 387/439: Merge pull request #110 from bbatsov/comment-fix, (continued)
- [elpa] externals/dash 5f879b3 387/439: Merge pull request #110 from bbatsov/comment-fix, Phillip Lord, 2015/08/04
- [elpa] externals/dash b7c2f9a 381/439: Work around byte compiler in -if-let*, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9642c4a 385/439: [Fix #108] Sync indentation of threading forms with Clojure, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1ccd2b4 389/439: Improve byte compilation test, Phillip Lord, 2015/08/04
- [elpa] externals/dash afe2781 388/439: Merge pull request #109 from bbatsov/threading-indentation, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2eefbec 386/439: Don't use an inline comment on a line of its own, Phillip Lord, 2015/08/04
- [elpa] externals/dash dab0d1c 384/439: Merge pull request #107 from fbergroth/workaround-byte-compiler, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7d62b1a 393/439: Make test suite independent of dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash 26c1bbe 390/439: Merge pull request #113 from fbergroth/fix-byte-compile-test, Phillip Lord, 2015/08/04
- [elpa] externals/dash c34e4ab 394/439: Update invalid tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 07f0358 392/439: Add test case operator !!> for expected errors,
Phillip Lord <=
- [elpa] externals/dash 92ed7ff 391/439: Use vendored ert only on emacs23, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7aec562 430/439: Merge pull request #140 from mijoharas/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash 63d2db9 431/439: make ->>'s second arg optional, Phillip Lord, 2015/08/04
- [elpa] externals/dash 45bd985 427/439: Reimplementation of --group-by., Phillip Lord, 2015/08/04
- [elpa] externals/dash aa13c07 429/439: fixed typo in docs (first where it should be last, Phillip Lord, 2015/08/04
- [elpa] externals/dash 70caa37 432/439: Merge pull request #144 from cammsaul/thread_last_make_second_arg_optional, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1677338 428/439: Merge pull request #138 from phillord/fix/group-by-write-out, Phillip Lord, 2015/08/04
- [elpa] externals/dash e468937 435/439: Formatting, Phillip Lord, 2015/08/04
- [elpa] externals/dash 89abffe 437/439: Make it explicit that not all VALS are evalled in -if-let*, Phillip Lord, 2015/08/04
- [elpa] externals/dash b88cfb7 436/439: Add dash prefix to epsilon variable., Phillip Lord, 2015/08/04