mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-05 17:47:30 +03:00
fix: fix leading % format in fmt (#1380)
This commit is contained in:
parent
027d8b3278
commit
bd653ad6e6
@ -14,7 +14,7 @@
|
||||
(if (= \% (String.char-at s (inc idx))) ; this is an escaped %
|
||||
`(ref
|
||||
(String.append
|
||||
"%"
|
||||
%(String.slice s 0 (inc idx))
|
||||
%(fmt-internal (String.slice s (+ idx 2) len) args)))
|
||||
(if (= 0 (length args)) ; we need to insert something, but have nothing
|
||||
(macro-error
|
||||
|
@ -34,6 +34,10 @@
|
||||
"10 % 12.0 yay"
|
||||
&(fmt "%d %% %.1f %s" 10 12.0 "yay")
|
||||
"fmt macro works")
|
||||
(assert-equal test
|
||||
"hi % 12.0"
|
||||
&(fmt "hi %% %.1f" 12.0)
|
||||
"fmt macro works with leading % (regression test)")
|
||||
(assert-equal test
|
||||
"1 [2 3] h"
|
||||
&(let [x 1
|
||||
|
Loading…
Reference in New Issue
Block a user