fix https://github.com/timotheecour/Nim/issues/718: CompileTime is not cached apparently (#17940)
This commit is contained in:
parent
5762b1d75c
commit
00bb3c779e
1 changed files with 5 additions and 2 deletions
|
|
@ -21,14 +21,17 @@ block:
|
||||||
|
|
||||||
template main() =
|
template main() =
|
||||||
# xxx merge more const related tests here
|
# xxx merge more const related tests here
|
||||||
|
const ct = CompileTime
|
||||||
|
# refs https://github.com/timotheecour/Nim/issues/718, apparently `CompileTime`
|
||||||
|
# isn't cached, which seems surprising.
|
||||||
block:
|
block:
|
||||||
const
|
const
|
||||||
a = """
|
a = """
|
||||||
Version $1|
|
Version $1|
|
||||||
Compiled at: $2, $3
|
Compiled at: $2, $3
|
||||||
""" % [NimVersion & spaces(44-len(NimVersion)), CompileDate, CompileTime]
|
""" % [NimVersion & spaces(44-len(NimVersion)), CompileDate, ct]
|
||||||
let b = $a
|
let b = $a
|
||||||
doAssert CompileTime in b, $(b, CompileTime)
|
doAssert ct in b, $(b, ct)
|
||||||
doAssert NimVersion in b
|
doAssert NimVersion in b
|
||||||
|
|
||||||
static: main()
|
static: main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue