follow up #19968; add more tests (#20396)

This commit is contained in:
ringabout 2022-09-21 04:14:01 +08:00 • committed by GitHub
commit de70128fcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,6 +88,66 @@ block:
doAssert y.b == {} doAssert y.b == {}
block:
type
X = object
a: string
b: int
var y = X(b: 1314)
reset(y)
doAssert y.b == 0
block:
type
X = object
a: string
b: float
var y = X(b: 1314.521)
reset(y)
doAssert y.b == 0.0
block:
type
X = object
a: string
b: string
var y = X(b: "1314")
reset(y)
doAssert y.b == ""
block:
type
X = object
a: string
b: seq[int]
var y = X(b: @[1, 3])
reset(y)
doAssert y.b == @[]
block:
type
X = object
a: string
b: tuple[a: int, b: string]
var y = X(b: (1, "cc"))
reset(y)
doAssert y.b == (0, "")
block: block:
type type
Color = enum Color = enum