diff --git a/TODO b/TODO index 2397b8f1..7627b84a 100644 --- a/TODO +++ b/TODO @@ -20,7 +20,6 @@ Working TODO list. should start creating issues for these to get them out of her - macros - next steps: - - migrate tests from test2.scm to unit-test suite - how should ex rename/compare work? check working implementations, papers. find test cases that cyclone does not handle right now - review 4 cases below for handling macro expansion. I think there are still some outstanding issues with respect to eval'd macros diff --git a/tests/unit-tests.scm b/tests/unit-tests.scm index 4a7cf41c..88096da3 100644 --- a/tests/unit-tests.scm +++ b/tests/unit-tests.scm @@ -295,6 +295,29 @@ ;; TODO: (delete-file "test.txt") ;; END I/O +;; Macros +(define-syntax test + (er-macro-transformer + (lambda (expr rename compare) + (cond ((null? (cdr expr)) #t) + ((null? (cddr expr)) (cadr expr)) + (else (list (rename 'if) (cadr expr) + (cons (rename 'and) (cddr expr)) + #f)))))) + +(define-syntax test2 + (er-macro-transformer + (lambda (expr rename compare) + (test 1 2) + (test 1 2 3) + (and ''test ''test2)))) + +(define x 42) +(assert:equal "macro: test2" (test2 1 2 3) 'test2) +(assert:equal "macro: test" (test 1 2 3) 3) +(assert:equal "macro: eval test" (eval '(test 1 2 x)) x) +;; END macros + ; TODO: use display, output without surrounding quotes (write (list *num-passed* " tests passed with no errors")) ;;