aboutsummaryrefslogtreecommitdiff
path: root/test/test-macros.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-01 19:03:34 -0500
committerSean Allred <code@seanallred.com>2015-01-01 19:03:34 -0500
commit01ac19db7ff5087e3c2b481a57d21d242ee9fb34 (patch)
tree76bff5cb0fc075542ad4f8b135b770591993c2d2 /test/test-macros.el
parent9650a1541b43da18067466df7671d23d5baffeed (diff)
parentbf4f193a76100917764f249023f4844a2ca15b2c (diff)
Merge pull request #185 from vermiculus/ert-refactor
Refactor tests
Diffstat (limited to 'test/test-macros.el')
-rw-r--r--test/test-macros.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test-macros.el b/test/test-macros.el
new file mode 100644
index 0000000..2169088
--- /dev/null
+++ b/test/test-macros.el
@@ -0,0 +1,22 @@
+(defmacro sx-test-with-json-data (cell &rest body)
+ "Run BODY with sample data let-bound to CELL"
+ (declare (indent 1))
+ `(let ((,cell '((test . nil) (test-one . 1) (test-two . 2)
+ (link . "http://meta.emacs.stackexchange.com/"))))
+ ,@body))
+
+(ert-deftest macro-test--sx-assoc-let ()
+ "Test `sx-assoc-let'"
+ (sx-test-with-json-data data
+ (should
+ (null (let-alist data .site))))
+
+ (sx-test-with-json-data data
+ (should
+ (equal (sx-assoc-let data .site)
+ "meta.emacs")))
+
+ (sx-test-with-json-data data
+ (should
+ (equal (sx-assoc-let data (cons .test-one .test-two))
+ '(1 . 2)))))