prettify reader test with a nice macro
This commit is contained in:
@@ -1,28 +1,17 @@
|
||||
(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"
|
||||
;; []-syntax. For array types and array access expressions
|
||||
(test '((¤ * char))
|
||||
(with-input-from-string "[* char]"
|
||||
(lambda ()
|
||||
(read-raw-forms 'stdin))))
|
||||
|
||||
(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)))))
|
||||
(reader-test '((¤ * char)) "[* char]")
|
||||
(reader-test '((¤ * * char const 512)) "[* * char const 512]")
|
||||
(reader-test '((¤)) "[]")
|
||||
(reader-test '((¤ (¤))) "[[]]")
|
||||
(reader-test '((¤ (¤ const char))) "[[const char]]")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user