mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
read-print: Add 'case' and 'cond' special forms.
* guix/read-print.scm (%special-forms): Add 'case' and 'cond'. * tests/read-print.scm: Add tests.
This commit is contained in:
parent
ff9522fb69
commit
6db3b34d72
2 changed files with 17 additions and 0 deletions
|
@ -255,6 +255,8 @@ (define %special-forms
|
|||
;; symbol must appear within a (modify-phases ...) expression.
|
||||
(vhashq
|
||||
('begin 1)
|
||||
('case 2)
|
||||
('cond 1)
|
||||
('lambda 2)
|
||||
('lambda* 2)
|
||||
('match-lambda 1)
|
||||
|
|
|
@ -141,6 +141,21 @@ (define-syntax-rule (test-pretty-print/sequence str args ...)
|
|||
(let ((z (+ x y)))
|
||||
(* z z)))")
|
||||
|
||||
(test-pretty-print "\
|
||||
(case x
|
||||
((1)
|
||||
'one)
|
||||
((2)
|
||||
'two))")
|
||||
|
||||
(test-pretty-print "\
|
||||
(cond
|
||||
((zero? x)
|
||||
'zero)
|
||||
((odd? x)
|
||||
'odd)
|
||||
(else #f))")
|
||||
|
||||
(test-pretty-print "\
|
||||
#~(string-append #$coreutils \"/bin/uname\")")
|
||||
|
||||
|
|
Loading…
Reference in a new issue