Added test cases

This commit is contained in:
Justin Ethier 2015-08-25 22:01:06 -04:00
parent df93439b5d
commit 1ac1372c8e
2 changed files with 23 additions and 1 deletions

1
TODO
View file

@ -20,7 +20,6 @@ Working TODO list. should start creating issues for these to get them out of her
- macros - macros
- next steps: - 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 - 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 - review 4 cases below for handling macro expansion. I think there are still some outstanding issues
with respect to eval'd macros with respect to eval'd macros

View file

@ -295,6 +295,29 @@
;; TODO: (delete-file "test.txt") ;; TODO: (delete-file "test.txt")
;; END I/O ;; 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 ; TODO: use display, output without surrounding quotes
(write (list *num-passed* " tests passed with no errors")) (write (list *num-passed* " tests passed with no errors"))
;; ;;