diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-04 17:11:07 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-04 17:11:07 -0200 |
commit | 917e70936ef82cfd2a34b541348ebd485049f46a (patch) | |
tree | 0fe936bfa609ea19c454cdcb4d1c2349d5c0c746 /test | |
parent | 89834aa61adf1fff29379c82ab96629f0b2960d0 (diff) | |
parent | 01df71244d3fe5412e2420127dcd2282d9fa39c7 (diff) |
Merge pull request #192 from vermiculus/filter-macro
Filter macro
Diffstat (limited to 'test')
-rw-r--r-- | test/test-macros.el | 22 | ||||
-rw-r--r-- | test/test-util.el | 14 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/test-macros.el b/test/test-macros.el index b6bf20b..1634603 100644 --- a/test/test-macros.el +++ b/test/test-macros.el @@ -20,3 +20,25 @@ (should (equal (sx-assoc-let data (cons .test-one .test-two)) '(1 . 2))))) + +(ert-deftest macro-test--sx-filter-from-nil () + "Test `sx-filter-from-nil'" + (should + (equal + (sx-filter-from-nil + (one two (three four five) (six seven) + (a b c d e))) + '((one two three.four three.five six.seven + a.b a.c a.d a.e + .backoff + .error_id + .error_message + .error_name + .has_more + .items + .page + .page_size + .quota_max + .quota_remaining + .total) + nil none)))) diff --git a/test/test-util.el b/test/test-util.el index 5db1691..1e3dc2b 100644 --- a/test/test-util.el +++ b/test/test-util.el @@ -29,3 +29,17 @@ (string= (sx--thing-as-string 'test& nil t) "test%26"))) + +(ert-deftest tree () + (should + (equal + (sx--tree-expand + (lambda (path) (mapconcat #'symbol-name path ".")) + '(a b (c d (e f g) h i (j k) l) m (n o) p)) + '("a" "b" "c.d" "c.e.f" "c.e.g" "c.h" "c.i" "c.j.k" "c.l" "m" "n.o" "p"))) + (should + (equal + (sx--tree-expand + (lambda (path) (intern (mapconcat #'symbol-name path "/"))) + '(a b (c d (e f g) h i (j k) l) m (n o) p)) + '(a b c/d c/e/f c/e/g c/h c/i c/j/k c/l m n/o p)))) |