diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-01 22:25:00 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-01 22:25:00 -0200 |
commit | 6cc480fdab287133d6e09a9ad1eba260b891b604 (patch) | |
tree | f54e0334389bb0f017b75b3e91061994f2fc44e3 /test/test-macros.el | |
parent | 026a6903e2bcc3a63da3db203b44516d9da3d9e4 (diff) | |
parent | e05f937910bb4ca0e7ea1c9f1273fbafac523921 (diff) |
Merge branch 'master' into inbox
Conflicts:
sx-question.el
sx.el
Diffstat (limited to 'test/test-macros.el')
-rw-r--r-- | test/test-macros.el | 22 |
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))))) |