[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/17: read-print: Add 'case' and 'cond' special forms.
From: |
guix-commits |
Subject: |
17/17: read-print: Add 'case' and 'cond' special forms. |
Date: |
Mon, 8 Aug 2022 05:55:11 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 6db3b34d7203639ef4286c237a6e536259f92352
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Aug 8 11:49:44 2022 +0200
read-print: Add 'case' and 'cond' special forms.
* guix/read-print.scm (%special-forms): Add 'case' and 'cond'.
* tests/read-print.scm: Add tests.
---
guix/read-print.scm | 2 ++
tests/read-print.scm | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/guix/read-print.scm b/guix/read-print.scm
index df25eb0f50..9d666d7f70 100644
--- a/guix/read-print.scm
+++ b/guix/read-print.scm
@@ -255,6 +255,8 @@ expressions and blanks that were read."
;; symbol must appear within a (modify-phases ...) expression.
(vhashq
('begin 1)
+ ('case 2)
+ ('cond 1)
('lambda 2)
('lambda* 2)
('match-lambda 1)
diff --git a/tests/read-print.scm b/tests/read-print.scm
index 004fcff19f..b484e28022 100644
--- a/tests/read-print.scm
+++ b/tests/read-print.scm
@@ -141,6 +141,21 @@ expressions."
(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\")")
- 01/17: lint: Add '-e'., (continued)
- 01/17: lint: Add '-e'., guix-commits, 2022/08/08
- 05/17: read-print: Expose comment constructor., guix-commits, 2022/08/08
- 02/17: gnu: go-gitlab.com-shackra-goimapnotify: Update to 2.3.7., guix-commits, 2022/08/08
- 07/17: style: Adjust test to not emit blank lines., guix-commits, 2022/08/08
- 08/17: read-print: Read and render vertical space., guix-commits, 2022/08/08
- 10/17: read-print: Add code to read and write sequences of expressions/blanks., guix-commits, 2022/08/08
- 12/17: style: Add '--whole-file' option., guix-commits, 2022/08/08
- 15/17: installer: Render the final configuration with (guix read-print)., guix-commits, 2022/08/08
- 13/17: news: Add entry for 'guix style -f'., guix-commits, 2022/08/08
- 16/17: installer: Add comments and vertical space to the generated config., guix-commits, 2022/08/08
- 17/17: read-print: Add 'case' and 'cond' special forms.,
guix-commits <=
- 14/17: read-print: Support printing multi-line comments., guix-commits, 2022/08/08
- 06/17: read-print: Introduce <blank> parent class of <comment>., guix-commits, 2022/08/08