forked from alex-eg/sex
prettify reader test with a nice macro
This commit is contained in:
@@ -1,28 +1,17 @@
|
|||||||
(import (chicken port))
|
(import (chicken port))
|
||||||
|
|
||||||
|
(define-syntax reader-test
|
||||||
|
(syntax-rules ()
|
||||||
|
((reader-test result string)
|
||||||
|
(test result
|
||||||
|
(with-input-from-string string
|
||||||
|
(lambda () (read-raw-forms 'stdin)))))))
|
||||||
|
|
||||||
(test-group "reader"
|
(test-group "reader"
|
||||||
;; []-syntax. For array types and array access expressions
|
;; []-syntax. For array types and array access expressions
|
||||||
(test '((¤ * char))
|
(reader-test '((¤ * char)) "[* char]")
|
||||||
(with-input-from-string "[* char]"
|
(reader-test '((¤ * * char const 512)) "[* * char const 512]")
|
||||||
(lambda ()
|
(reader-test '((¤)) "[]")
|
||||||
(read-raw-forms 'stdin))))
|
(reader-test '((¤ (¤))) "[[]]")
|
||||||
|
(reader-test '((¤ (¤ const char))) "[[const char]]")
|
||||||
(test '((¤ * * char const 512))
|
)
|
||||||
(with-input-from-string "[* * char const 512]"
|
|
||||||
(lambda ()
|
|
||||||
(read-raw-forms 'stdin))))
|
|
||||||
|
|
||||||
(test '((¤))
|
|
||||||
(with-input-from-string "[]"
|
|
||||||
(lambda ()
|
|
||||||
(read-raw-forms 'stdin))))
|
|
||||||
|
|
||||||
(test '((¤ (¤)))
|
|
||||||
(with-input-from-string "[[]]"
|
|
||||||
(lambda ()
|
|
||||||
(read-raw-forms 'stdin))))
|
|
||||||
|
|
||||||
(test '((¤ (¤ const char)))
|
|
||||||
(with-input-from-string "[[const char]]"
|
|
||||||
(lambda ()
|
|
||||||
(read-raw-forms 'stdin)))))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user