dumpToString: improves on sugar.dump (#16841)
* dumpToString * _ * fixup * changelog * address comment: removed the word "Deprecated"
This commit is contained in:
parent
15d6be52a1
commit
4b2054a7bf
3 changed files with 44 additions and 4 deletions
|
|
@ -107,4 +107,14 @@ doAssert collect(for d in data.items: {d}) == data.toHashSet
|
|||
# bug #14332
|
||||
template foo =
|
||||
discard collect(newSeq, for i in 1..3: i)
|
||||
foo()
|
||||
foo()
|
||||
|
||||
block: # dumpToString
|
||||
template square(x): untyped = x * x
|
||||
let x = 10
|
||||
doAssert dumpToString(square(x)) == "square(x): x * x = 100"
|
||||
let s = dumpToString(doAssert 1+1 == 2)
|
||||
doAssert "failedAssertImpl" in s
|
||||
let s2 = dumpToString:
|
||||
doAssertRaises(AssertionDefect): doAssert false
|
||||
doAssert "except AssertionDefect" in s2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue