summaryrefslogtreecommitdiffstats
path: root/tests/012
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-12-08 21:14:51 -0800
committerKaz Kylheku <kaz@kylheku.com>2023-12-08 21:14:51 -0800
commit2b896e09bdf71fb94e40a105b681c26938daa961 (patch)
treed86ed08a261777b73ba120446bcd8d776f94415f /tests/012
parent7c54bf4d7b251cbe49ee1eb56f167917c772671b (diff)
downloadtxr-2b896e09bdf71fb94e40a105b681c26938daa961.tar.gz
txr-2b896e09bdf71fb94e40a105b681c26938daa961.tar.bz2
txr-2b896e09bdf71fb94e40a105b681c26938daa961.zip
print: print/read consistency problem with rcons.
* lib.c (obj_print_impl): Do not print (rcons X Y) as X..Y if X looks like (rcons ...). This causes the problem that (rcons (rcons 1 2) 3) prints as 1..2..3, a notation which unambiguously means (rcons 1 (rcons 2 3)). * tests/012/syntax.tl: New test cases.
Diffstat (limited to 'tests/012')
-rw-r--r--tests/012/syntax.tl9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/012/syntax.tl b/tests/012/syntax.tl
index d2fab599..bc7d9668 100644
--- a/tests/012/syntax.tl
+++ b/tests/012/syntax.tl
@@ -63,3 +63,12 @@
'(1.234,e+12) (1.234 (sys:unquote e+12))
'(1.,234) (1.0 (sys:unquote 234)))
+(mtest
+ (read "0..1") (rcons 0 1)
+ (read "0..1..2") (rcons 0 (rcons 1 2)))
+
+(mtest
+ (tostring '(rcons 0 1)) "0..1"
+ (tostring '(rcons 0 (rcons 1 2))) "0..1..2"
+ (tostring '(rcons (rcons 0 1) 2)) "(rcons 0..1 2)"
+ (tostring '(rcons (rcons 0 1) (rcons 2 3))) "(rcons 0..1 2..3)")