mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 11:24:08 +00:00
committed by
Andreas Rumpf
parent
4deda6b732
commit
7674df0dff
@@ -258,7 +258,9 @@ template callFormat(res, arg) {.dirty.} =
|
||||
# workaround in order to circumvent 'strutils.format' which matches
|
||||
# too but doesn't adhere to our protocol.
|
||||
res.add arg
|
||||
elif compiles(format(arg, res)):
|
||||
elif compiles(format(arg, res)) and
|
||||
# Check if format returns void
|
||||
not (compiles do: discard format(arg, res)):
|
||||
format(arg, res)
|
||||
elif compiles(format(arg)):
|
||||
res.add format(arg)
|
||||
@@ -684,6 +686,9 @@ when isMainModule:
|
||||
var nullTime: DateTime
|
||||
check &"{nullTime:yyyy-mm-dd}", "0000-00-00"
|
||||
|
||||
var tm = fromUnix(0)
|
||||
discard &"{tm}"
|
||||
|
||||
# Unicode string tests
|
||||
check &"""{"αβγ"}""", "αβγ"
|
||||
check &"""{"αβγ":>5}""", " αβγ"
|
||||
|
||||
Reference in New Issue
Block a user