fixes another regression; the behaviour of 'array' formatting was changed
This commit is contained in:
parent
59ccaa43c7
commit
a517a9985b
2 changed files with 8 additions and 8 deletions
|
|
@ -513,14 +513,6 @@ template formatValue(result: var string; value: char; specifier: string) =
|
||||||
template formatValue(result: var string; value: cstring; specifier: string) =
|
template formatValue(result: var string; value: cstring; specifier: string) =
|
||||||
result.add value
|
result.add value
|
||||||
|
|
||||||
proc formatValue(result: var string; value: (array|seq|openArray); specifier: string) =
|
|
||||||
result.add "["
|
|
||||||
for i, it in value:
|
|
||||||
if i != 0:
|
|
||||||
result.add ", "
|
|
||||||
result.formatValue(it, specifier)
|
|
||||||
result.add "]"
|
|
||||||
|
|
||||||
macro `&`*(pattern: string): untyped =
|
macro `&`*(pattern: string): untyped =
|
||||||
## For a specification of the ``&`` macro, see the module level documentation.
|
## For a specification of the ``&`` macro, see the module level documentation.
|
||||||
if pattern.kind notin {nnkStrLit..nnkTripleStrLit}:
|
if pattern.kind notin {nnkStrLit..nnkTripleStrLit}:
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,14 @@ doAssert fmt"{0.0: g}" == " 0"
|
||||||
let data1 = [1'i64, 10000'i64, 10000000'i64]
|
let data1 = [1'i64, 10000'i64, 10000000'i64]
|
||||||
let data2 = [10000000'i64, 100'i64, 1'i64]
|
let data2 = [10000000'i64, 100'i64, 1'i64]
|
||||||
|
|
||||||
|
proc formatValue(result: var string; value: (array|seq|openArray); specifier: string) =
|
||||||
|
result.add "["
|
||||||
|
for i, it in value:
|
||||||
|
if i != 0:
|
||||||
|
result.add ", "
|
||||||
|
result.formatValue(it, specifier)
|
||||||
|
result.add "]"
|
||||||
|
|
||||||
doAssert fmt"data1: {data1:8} #" == "data1: [ 1, 10000, 10000000] #"
|
doAssert fmt"data1: {data1:8} #" == "data1: [ 1, 10000, 10000000] #"
|
||||||
doAssert fmt"data2: {data2:8} =" == "data2: [10000000, 100, 1] ="
|
doAssert fmt"data2: {data2:8} =" == "data2: [10000000, 100, 1] ="
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue