summary refs log tree commit diff
path: root/tests/read-print.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-09-01 15:54:08 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-01 18:31:26 +0200
commitc3b1cfe76b7038f4030d7d207ffc417fed9a7ead (patch)
treedd1e118336d2d1f915c003ac3af46b374fe9c043 /tests/read-print.scm
parent8cf7997d7c068eb87eadbd28ac8be4e0aeddbba3 (diff)
downloadguix-c3b1cfe76b7038f4030d7d207ffc417fed9a7ead.tar.gz
read-print: Guess the base to use for integers being printed.
Fixes <https://issues.guix.gnu.org/57090>.
Reported by Christopher Rodriguez <yewscion@gmail.com>.

* guix/read-print.scm (%symbols-followed-by-octal-integers)
(%symbols-followed-by-hexadecimal-integers): New variables.
* guix/read-print.scm (integer->string): New procedure.
(pretty-print-with-comments): Use it.
* tests/read-print.scm: Add test.
Diffstat (limited to 'tests/read-print.scm')
-rw-r--r--tests/read-print.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/read-print.scm b/tests/read-print.scm
index 4dabcc1e64..1b0d865972 100644
--- a/tests/read-print.scm
+++ b/tests/read-print.scm
@@ -248,6 +248,14 @@ mnopqrstuvwxyz.\")"
   (list x y z))")
 
 (test-pretty-print "\
+(begin
+  (chmod \"foo\" #o750)
+  (chmod port
+         (logand #o644
+                 (lognot (umask))))
+  (logand #x7f xyz))")
+
+(test-pretty-print "\
 (substitute-keyword-arguments (package-arguments x)
   ((#:phases phases)
    `(modify-phases ,phases