* fixes #12899

* fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it
This commit is contained in:
Andreas Rumpf 2019-12-18 07:54:20 +01:00 • committed by GitHub
commit 3f6df5cc34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 15 deletions

View file

@ -1,7 +1,9 @@
discard """
valgrind: true
cmd: '''nim c --newruntime -d:useMalloc $file'''
output: '''422 422'''
output: '''
@[(input: @["KXSC", "BGMC"]), (input: @["PXFX"]), (input: @["WXRQ", "ZSCZD"])]
461 461'''
"""
import strutils, os, std / wordwrap
@ -13,6 +15,28 @@ import system / ansi_c
proc retTuple(): (seq[int], int) =
return (@[1], 1)
# bug #12899
import sequtils, strmisc
const input = ["KXSC, BGMC => 7 PTHL", "PXFX => LBZJ", "WXRQ, ZSCZD => HLQM"]
type
Reaction = object
input: seq[string]
proc bug12899 =
var reactions: seq[Reaction] = @[]
for l in input:
let x = l.partition(" => ")
reactions.add Reaction(input: @(x[0].split(", ")))
let x = $reactions
echo x
bug12899()
proc nonStaticTests =
doAssert formatBiggestFloat(1234.567, ffDecimal, -1) == "1234.567000"
doAssert formatBiggestFloat(1234.567, ffDecimal, 0) == "1235" # bugs 8242, 12586