[109853] branches/gsoc13-tests/src/macports1.0/tests/macports_util.test

marius at macports.org marius at macports.org
Tue Aug 20 11:57:17 PDT 2013


Revision: 109853
          https://trac.macports.org/changeset/109853
Author:   marius at macports.org
Date:     2013-08-20 11:57:17 -0700 (Tue, 20 Aug 2013)
Log Message:
-----------
macports_util.test: fixed throw, try tests

Modified Paths:
--------------
    branches/gsoc13-tests/src/macports1.0/tests/macports_util.test

Modified: branches/gsoc13-tests/src/macports1.0/tests/macports_util.test
===================================================================
--- branches/gsoc13-tests/src/macports1.0/tests/macports_util.test	2013-08-20 18:56:40 UTC (rev 109852)
+++ branches/gsoc13-tests/src/macports1.0/tests/macports_util.test	2013-08-20 18:57:17 UTC (rev 109853)
@@ -121,25 +121,34 @@
 
 test throw {
     Throw unit test.
-} -body {
+} -setup {
     proc test_proc {arg} {
-	catch {
-	    throw $arg
-	}
+	catch {throw $arg} res
+	return $res
     }
-    if {[test_proc ""] != 1} {
+} -body {
+    if {[test_proc {7 msg info}] != "error: 7 msg info"} {
+	return "FAIL: wrong error returneed"
+    }
+    if {[catch {test_proc ""}] != 0} {
 	return "FAIL: wrong value returned"
     }
-    #puts [catch {test_proc {7 "msg" "info"}}]
     return "throw successful."
 } -result "throw successful."
 
 
 test try {
     Try unit test.
+} -setup {
+    proc test_proc {} {try {return 7} catch * {return 6}}
+    proc test_proc2 {} {try {error "msg" "info" 3} catch * {return 6}}
 } -body {
-    #puts [catch {try {return 7} catch * {return 6}}]
-    #puts [catch {try {error "msg" "info" 3} catch * {return 6}}]
+    if {[test_proc] != 7} {
+	return "FAIL: try clause not working"
+    }
+    if {[test_proc2] != 6} {
+	reutrn "FAIL: catch clause not working"
+    }
     if {[catch {try}] != 1} {
 	return "FAIL: no args err not detected"
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130820/abe207d3/attachment.html>


More information about the macports-changes mailing list