mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
fix https://github.com/timotheecour/Nim/issues/718: CompileTime is not cached apparently (#17940)
This commit is contained in:
@@ -21,14 +21,17 @@ block:
|
||||
|
||||
template main() =
|
||||
# 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:
|
||||
const
|
||||
a = """
|
||||
Version $1|
|
||||
Compiled at: $2, $3
|
||||
""" % [NimVersion & spaces(44-len(NimVersion)), CompileDate, CompileTime]
|
||||
""" % [NimVersion & spaces(44-len(NimVersion)), CompileDate, ct]
|
||||
let b = $a
|
||||
doAssert CompileTime in b, $(b, CompileTime)
|
||||
doAssert ct in b, $(b, ct)
|
||||
doAssert NimVersion in b
|
||||
|
||||
static: main()
|
||||
|
||||
Reference in New Issue
Block a user