fixes #18134; registers formatBiggestFloat in VM (#21299)

fixes #18134; registers formatBiggestFloat in vmops

strformat supports float format in VM
This commit is contained in:
ringabout
2023-01-27 06:03:59 +08:00
committed by GitHub
parent 23bd812b0c
commit fc068ee06d
3 changed files with 73 additions and 61 deletions

View File

@@ -475,15 +475,17 @@ proc main() =
# Note: times.format adheres to the format protocol. Test that this
# works:
when nimvm:
discard
else:
var dt = dateTime(2000, mJan, 01, 00, 00, 00)
check &"{dt:yyyy-MM-dd}", "2000-01-01"
var dt = initDateTime(01, mJan, 2000, 00, 00, 00)
check &"{dt:yyyy-MM-dd}", "2000-01-01"
var tm = fromUnix(0)
discard &"{tm}"
var tm = fromUnix(0)
discard &"{tm}"
var noww = now()
check &"{noww}", $noww
var noww = now()
check &"{noww}", $noww
# Unicode string tests
check &"""{"αβγ"}""", "αβγ"
@@ -558,5 +560,6 @@ proc main() =
doAssert &"""{(if true: "'" & "'" & ')' else: "")}""" == "'')"
doAssert &"{(if true: \"\'\" & \"'\" & ')' else: \"\")}" == "'')"
doAssert fmt"""{(if true: "'" & ')' else: "")}""" == "')"
# xxx static: main()
static: main()
main()