From e02e8968c4ae11fc9f8230c449526aa7c87f9231 Mon Sep 17 00:00:00 2001 From: Rostyslav Dzinko Date: Thu, 17 Sep 2015 12:50:51 +0300 Subject: [PATCH] Moved teardown call to try block for namespace access reasons --- lib/pure/unittest.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index a0f7b955e9..aca9d51e22 100755 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -150,6 +150,8 @@ template test*(name: expr, body: stmt): stmt {.immediate, dirty.} = try: when declared(testSetupIMPLFlag): testSetupIMPL() body + when declared(testTeardownIMPLFlag): + defer: testTeardownIMPL() except: when not defined(js): @@ -158,7 +160,6 @@ template test*(name: expr, body: stmt): stmt {.immediate, dirty.} = fail() finally: - when declared(testTeardownIMPLFlag): testTeardownIMPL() testDone name, testStatusIMPL proc checkpoint*(msg: string) =