From b45ad18c6c725693ccb23cad53b0264b3c368259 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Fri, 20 Jun 2014 20:50:48 +0000
Subject: previous commit was not quite right, this one should be better

---
 library/tcltest/tcltest.tcl | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index 7dd969b..22d79e1 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -1991,20 +1991,6 @@ proc tcltest::test {name description args} {
 	}
     }
 
-    # check if the return code matched the expected return code
-    set codeFailure 0
-    if {!$setupFailure && ($returnCode ni $returnCodes)} {
-	set codeFailure 1
-    }
-
-    # Always run the cleanup script
-    set code [catch {uplevel 1 $cleanup} cleanupMsg]
-    if {$code == 1} {
-	set errorInfo(cleanup) $::errorInfo
-	set errorCode(cleanup) $::errorCode
-    }
-    set cleanupFailure [expr {$code != 0}]
-
     set coreFailure 0
     set coreMsg ""
     # check for a core file first - if one was created by the test,
@@ -2038,6 +2024,12 @@ proc tcltest::test {name description args} {
 	}
     }
 
+    # check if the return code matched the expected return code
+    set codeFailure 0
+    if {!$setupFailure && ($returnCode ni $returnCodes)} {
+	set codeFailure 1
+    }
+
     # If expected output/error strings exist, we have to compare
     # them.  If the comparison fails, then so did the test.
     set outputFailure 0
@@ -2076,6 +2068,14 @@ proc tcltest::test {name description args} {
 	set scriptFailure 1
     }
 
+    # Always run the cleanup script
+    set code [catch {uplevel 1 $cleanup} cleanupMsg]
+    if {$code == 1} {
+	set errorInfo(cleanup) $::errorInfo
+	set errorCode(cleanup) $::errorCode
+    }
+    set cleanupFailure [expr {$code != 0}]
+
     # if we didn't experience any failures, then we passed
     variable numTests
     if {!($setupFailure || $cleanupFailure || $coreFailure
-- 
cgit v0.12