Test the path_filter function
authorPat Thoyts <patthoyts@users.sourceforge.net>
Thu, 25 Feb 2010 11:08:15 +0000 (11:08 +0000)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Thu, 25 Feb 2010 11:08:15 +0000 (11:08 +0000)
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
tests/all.tcl [new file with mode: 0644]
tests/path_filter.test [new file with mode: 0644]

diff --git a/tests/all.tcl b/tests/all.tcl
new file mode 100644 (file)
index 0000000..63f567e
--- /dev/null
@@ -0,0 +1,5 @@
+package require Tcl 8.4
+package require tcltest 2
+tcltest::configure -testdir [file dirname [info script]]
+eval [linsert $argv 0 tcltest::configure]
+tcltest::runAllTests
diff --git a/tests/path_filter.test b/tests/path_filter.test
new file mode 100644 (file)
index 0000000..3f9322c
--- /dev/null
@@ -0,0 +1,26 @@
+package require tcltest
+namespace import -force tcltest::*
+
+# Load gitk as library for testing from the parent of the test directory
+source [file join [file dirname [testsDirectory]] gitk]
+
+
+set tests {
+    1  ""   gitk   0
+    2  .    gitk   1
+    3  ./   gitk   1
+    4  po   po/de.po  1
+    5  ./po po/de.po 1
+    6  po   gitk   0
+    7  po   a/b    0
+    8  a    a/b/c  1
+}
+foreach {id filter name result} $tests {
+    test path_filter-$id "path_filter $filter $name" -body {
+        path_filter $filter $name
+    } -result $result
+}
+unset tests
+
+::tcltest::cleanupTests
+return
\ No newline at end of file