summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-19 06:46:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-19 06:46:10 -0700
commitb946f2c2dfa53016ce1b30c568fa8f1f61f9bae9 (patch)
tree22291ccd27390b8b0cdfbeb390fdd3bc4ea37170 /tests
parent6ee766e631b512f63a444a28e67fc79b69a0e5a6 (diff)
downloadtxr-b946f2c2dfa53016ce1b30c568fa8f1f61f9bae9.tar.gz
txr-b946f2c2dfa53016ce1b30c568fa8f1f61f9bae9.tar.bz2
txr-b946f2c2dfa53016ce1b30c568fa8f1f61f9bae9.zip
pic: support parenthesis negative notation.
* pic.tl (add-neg-parens): New system function. (expand-neg-parens): New macro. (expand-pic): New numeric pattern with parentheses. Also suport escaping of parentheses. (pic): Recognize parenthesized numeric pattern here also. * tests/018/format.tl: New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/018/format.tl22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/018/format.tl b/tests/018/format.tl
index 0758d32f..6fc27b4e 100644
--- a/tests/018/format.tl
+++ b/tests/018/format.tl
@@ -243,9 +243,25 @@
(pic "#,#,#!" 123) "1,2,3"
(pic "#,#,#!" 1234) "#,#,#")
-(test (mapcar (do pic "foo~-0##.jpg") (rlist 0..5 8 12))
- ("foo-000.jpg" "foo-001.jpg" "foo-002.jpg" "foo-003.jpg"
- "foo-004.jpg" "foo-005.jpg" "foo-008.jpg" "foo-012.jpg"))
+(mtest
+ (pic "(#,###,###.##)" 123456.56) " 123,456.56 "
+ (pic "(#,###,###.##)" 1234566.56) " 1,234,566.56 "
+ (pic "(#,###,###.##)" 12345667.56) "12,345,667.56 "
+ (pic "(#,###,###.##)" 123456678.56) "123,456,678.56"
+ (pic "(#,###,###.##)" -123456.56) "( 123,456.56)"
+ (pic "(#,###,###.##)" -1234566.56) "(1,234,566.56)"
+ (pic "(#,###,###.##)" -12345667.56) "(12,345,667.56)"
+ (pic "(#,###,###.##)" -123456678.56) "(123,456,678.56)")
+
+(mtest
+ (pic "(0,###,###.##)" 123456.56) " 0,123,456.56 "
+ (pic "(0,###,###.##)" 1234566.56) " 1,234,566.56 "
+ (pic "(0,###,###.##)" 12345667.56) "12,345,667.56 "
+ (pic "(0,###,###.##)" 123456678.56) "123,456,678.56"
+ (pic "(0,###,###.##)" -123456.56) "(0,123,456.56)"
+ (pic "(0,###,###.##)" -1234566.56) "(1,234,566.56)"
+ (pic "(0,###,###.##)" -12345667.56) "(12,345,667.56)"
+ (pic "(0,###,###.##)" -123456678.56) "(123,456,678.56)")
(test
(let ((a 2) (b "###") (c 13.5))