diff options
author | Sean Allred <code@seanallred.com> | 2015-01-02 12:47:03 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2015-01-02 12:47:03 -0500 |
commit | cf97f4c691ff5a2ee001e1f22e2eed0d7f6a9df8 (patch) | |
tree | 2f521c8f35a9a65f9da02eab4ff83257aa0a0260 /test/test-macros.el | |
parent | 542ddf73506c2c297106e4b3f4ec0a1d80a35ad8 (diff) | |
parent | 9a420bffcc426b4826f14ad1f62b5430750821df (diff) |
Merge branch 'master' into goto-map
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..b6bf20b --- /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_par)))) + + (sx-test-with-json-data data + (should + (equal (sx-assoc-let data .site_par) + "meta.emacs"))) + + (sx-test-with-json-data data + (should + (equal (sx-assoc-let data (cons .test-one .test-two)) + '(1 . 2))))) |