From 7d2cccd82cf6c658e330767d0e20e48e42ff1ac6 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Sat, 20 Dec 2014 02:22:37 -0500 Subject: Fix `sx-assoc-let' tests `require' form is no longer needed -- macro expansion is done with the expansion of `sx-assoc-let'. --- test/tests.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/tests.el b/test/tests.el index 66d8d88..cc58105 100644 --- a/test/tests.el +++ b/test/tests.el @@ -121,14 +121,16 @@ (ert-deftest macro-test--sx-assoc-let () "Tests macro expansion for `sx-assoc-let'" (should - (equal '(progn (require 'let-alist) - (sx--ensure-site data) - (let-alist data .test)) - (macroexpand '(sx-assoc-let data .test)))) + (equal `(progn (sx--ensure-site data) + ,(macroexpand + '(let-alist data .test))) + (macroexpand + '(sx-assoc-let data .test)))) (should - (equal '(progn (require 'let-alist) - (sx--ensure-site data) - (let-alist data (cons .test-one .test-two))) + (equal `(progn (sx--ensure-site data) + ,(macroexpand + '(let-alist data + (cons .test-one .test-two)))) (macroexpand '(sx-assoc-let data (cons .test-one .test-two)))))) -- cgit v1.2.3 From 06f7059bffa517d63c72a0815ff0779cfe5e5ce2 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Tue, 30 Dec 2014 23:07:36 -0500 Subject: Test sx-assoc-let according to functionality See http://emacs.stackexchange.com/q/5915/2264 and #151 for more information. This patch tests for functional equivalence rather than symbolic equivalence. Symbolic equivalence would be far preferable, but it does not appear to be happening anytime soon -- perhaps when things settle down a bit for the authors :) --- test/tests.el | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/tests.el b/test/tests.el index cc58105..3c275fd 100644 --- a/test/tests.el +++ b/test/tests.el @@ -120,19 +120,21 @@ (ert-deftest macro-test--sx-assoc-let () "Tests macro expansion for `sx-assoc-let'" - (should - (equal `(progn (sx--ensure-site data) - ,(macroexpand - '(let-alist data .test))) - (macroexpand - '(sx-assoc-let data .test)))) - (should - (equal `(progn (sx--ensure-site data) - ,(macroexpand - '(let-alist data - (cons .test-one .test-two)))) - (macroexpand - '(sx-assoc-let data (cons .test-one .test-two)))))) + (let ((prototype '((test . nil) (test-one . 1) (test-two . 2) + (link . "http://meta.emacs.stackexchange.com/")))) + (let ((data (copy-tree prototype))) + (should + (null (let-alist data .site)))) + + (let ((data (copy-tree prototype))) + (should + (equal (sx-assoc-let data .site) + "meta.emacs"))) + + (let ((data (copy-tree prototype))) + (should + (equal (sx-assoc-let data (cons .test-one .test-two)) + '(1 . 2)))))) (ert-deftest sx--user-@name () "Tests macro expansion for `sx-assoc-let'" -- cgit v1.2.3