mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
dumpToString: improves on sugar.dump (#16841)
* dumpToString * _ * fixup * changelog * address comment: removed the word "Deprecated"
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user