[107499] branches/gsoc13-tests/tests/test/case-insensitive-deactivate/test. tcl

marius at macports.org marius at macports.org
Mon Jul 1 10:23:19 PDT 2013


Revision: 107499
          https://trac.macports.org/changeset/107499
Author:   marius at macports.org
Date:     2013-07-01 10:23:19 -0700 (Mon, 01 Jul 2013)
Log Message:
-----------
Added case-insensitive test.

Added Paths:
-----------
    branches/gsoc13-tests/tests/test/case-insensitive-deactivate/test.tcl

Added: branches/gsoc13-tests/tests/test/case-insensitive-deactivate/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/case-insensitive-deactivate/test.tcl	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/case-insensitive-deactivate/test.tcl	2013-07-01 17:23:19 UTC (rev 107499)
@@ -0,0 +1,71 @@
+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+set file "output"
+set dir "work"
+set path [file dirname [file normalize $argv0]]
+
+set testfile "/tmp/macports-tests/opt/local/var/test/case"
+set testport1 "casesensitive"
+set testport2 "CaseSensitivE"
+
+load_variables $path
+set_dir
+port_index
+
+proc test_exists {} {
+    global path
+    global testfile
+    global testport1
+
+    exec sed "s/@name@/$testport1/" $path/Portfile.in > Portfile
+    port_install
+
+    if {[file exists $testfile]} {
+        return "Port installed."
+    } else {
+        return "File missing."
+    }
+}
+
+proc test_not_exists {} {
+    global path
+    global testfile
+    global testport2
+
+    exec sed "s/@name@/$testport2/" $path/Portfile.in > Portfile
+    port_uninstall
+
+    if {[file exists $testfile]} {
+        return "File still exists."
+    } else {
+        return "Port uninstalled."
+    }
+}
+
+# Test cases.
+test file_installed {
+    Regression test for file installed correctly.
+} -constraints {
+    root
+} -body {
+    test_exists
+} -result "Port installed."
+
+test file_uninstalled {
+    Regression test for file uninstalled correctly.
+} -constraints {
+    root
+} -body {
+    test_not_exists
+} -result "Port uninstalled."
+
+# remove output file and print results
+removeFile Portfile
+removeFile $file
+removeDirectory $dir
+
+cleanup
+cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130701/69840dcd/attachment-0001.html>


More information about the macports-changes mailing list