summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRostyslav Dzinko <rostislav.dzinko@gmail.com>2015-09-17 12:50:51 +0300
committerRostyslav Dzinko <rostislav.dzinko@gmail.com>2015-09-17 13:11:51 +0300
commite02e8968c4ae11fc9f8230c449526aa7c87f9231 (patch)
tree45d5df3095b55df40ab794b2a619dc0617bae95a
parent671e5db21e49fa4efbfe46a5215673f5826b25c3 (diff)
downloadNim-e02e8968c4ae11fc9f8230c449526aa7c87f9231.tar.gz
Moved teardown call to try block for namespace access reasons
-rwxr-xr-xlib/pure/unittest.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index a0f7b955e..aca9d51e2 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) =