瀏覽代碼

Add "expect-error" macro

Ryan C. Thompson 8 年之前
父節點
當前提交
fe27ae0d3e
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      tests/test-ido-completing-read+.el

+ 4 - 0
tests/test-ido-completing-read+.el

@@ -38,6 +38,10 @@ passed to `all-completions' and `try-completion'."
      ;; Delete the saved value from the symbol plist
      (put var 'test-saved-value nil))))
 
+(cl-defmacro expect-error (expr &key (error-symbol 'error))
+  "Shortcut for `(expect (lambda () ...) :to-throw)'"
+  `(expect (lambda () ,expr) :to-throw ',error-symbol))
+
 (describe "Within the `ido-completing-read+' package"
 
   ;; Reset all of these variables to their standard values before each