mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-09 14:07:34 +02:00
Added test cases
This commit is contained in:
parent
df93439b5d
commit
1ac1372c8e
2 changed files with 23 additions and 1 deletions
1
TODO
1
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
|
||||
|
|
|
@ -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"))
|
||||
;;
|
||||
|
|
Loading…
Add table
Reference in a new issue