[91745] trunk/base/src/port1.0/tests

cal at macports.org cal at macports.org
Mon Apr 9 06:57:04 PDT 2012


Revision: 91745
          https://trac.macports.org/changeset/91745
Author:   cal at macports.org
Date:     2012-04-09 06:57:03 -0700 (Mon, 09 Apr 2012)
Log Message:
-----------
Tests for r91744.

Revision Links:
--------------
    https://trac.macports.org/changeset/91744

Added Paths:
-----------
    trunk/base/src/port1.0/tests/common.tcl
    trunk/base/src/port1.0/tests/portdestroot.tcl

Added: trunk/base/src/port1.0/tests/common.tcl
===================================================================
--- trunk/base/src/port1.0/tests/common.tcl	                        (rev 0)
+++ trunk/base/src/port1.0/tests/common.tcl	2012-04-09 13:57:03 UTC (rev 91745)
@@ -0,0 +1,18 @@
+proc test_equal {statement value} {
+    uplevel 1 "\
+        puts -nonewline {checking if $statement == \"$value\"... }
+        if {\[catch {
+                set actual $statement
+                if {\$actual == \[subst {$value}\]} { \n\
+                    puts yes
+                } else { \n\
+                    puts \"no (was \$actual)\" \n\
+                    exit 1 \n\
+                } \n\
+            } msg\]} { \n\
+                puts \"caught error: \$msg\" \n\
+                exit 1 \n\
+            }"
+}
+
+

Added: trunk/base/src/port1.0/tests/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/tests/portdestroot.tcl	                        (rev 0)
+++ trunk/base/src/port1.0/tests/portdestroot.tcl	2012-04-09 13:57:03 UTC (rev 91745)
@@ -0,0 +1,39 @@
+package require macports
+mportinit
+
+source [file dirname [info script]]/../portdestroot.tcl
+source [file dirname [info script]]/common.tcl
+
+namespace eval tests {
+
+proc "when destroot cmd is not gmake no -w argument is added" {} {
+    global build.type build.cmd destroot.cmd destroot.target
+
+    set build.type "gnu"
+    set build.cmd "gmake"
+    set destroot.cmd "_destroot_cmd_"
+    set destroot.target "_target_"
+
+    test_equal {[portdestroot::destroot_getargs]} "_target_"
+}
+
+proc "when destroot cmd is gmake a -w argument is added" {} {
+    global build.type build.cmd destroot.cmd destroot.target
+
+    set build.type "gnu"
+    set build.cmd "_build_cmd_"
+    set destroot.cmd "gmake"
+    set destroot.target "_target_"
+
+    test_equal {[portdestroot::destroot_getargs]} "-w _target_"
+}
+
+
+# run all tests
+foreach proc [info procs *] {
+    puts "* ${proc}"
+    $proc
+}
+
+# namespace eval tests
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120409/51d86daf/attachment.html>


More information about the macports-changes mailing list