Added tests script.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Nov 2001 14:22:21 +0000 (14:22 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Nov 2001 14:22:21 +0000 (14:22 +0000)
tests.tcl [new file with mode: 0644]

diff --git a/tests.tcl b/tests.tcl
new file mode 100644 (file)
index 0000000..a0225ff
--- /dev/null
+++ b/tests.tcl
@@ -0,0 +1,108 @@
+# $Id: tests.tcl,v 1.1 2001/11/08 14:22:21 adam Exp $
+proc testhref {} {
+    global URL
+
+    foreach testref {
+        {../../k.htm /k.htm}
+        {../k.htm /k.htm}
+        {.././k.htm /k.htm}
+        {./../k.htm /k.htm}
+        {k.htm /k.htm} 
+        {./k.htm /k.htm} 
+        {/../k.htm /k.htm}
+        {/./../.././k.htm /k.htm}
+        {../../peter/k.htm /peter/k.htm}
+        {../../ /}
+        {/// /}
+        {../.. /}} {
+        set URL(t,hostport) http://bilbasen.tv2.dk
+        set URL(t,path) /
+        set href [lindex $testref 0]
+        puts -nonewline "testing href=$href "
+        RobotHref t href host path
+        if {[string compare $path [lindex $testref 1]]} {
+            puts "failed"
+            puts "  href=$href"
+            puts "  host=$host"
+            puts "  path=$path"
+        } else {
+            puts "OK"
+        }
+    }
+    foreach testref {
+        {../../k.htm /k.htm}
+        {../k.htm /k.htm}
+        {.././k.htm /k.htm}
+        {./../k.htm /k.htm}
+        {k.htm /k.htm} 
+        {./k.htm /k.htm} 
+        {/../k.htm /k.htm}
+        {/./../.././k.htm /k.htm}
+        {../../peter/k.htm /peter/k.htm}
+        {../../ /}
+        {../.. /}} {
+        set URL(t,hostport) http://bilbasen.tv2.dk
+        set URL(t,path) /not_good.asp
+        set href [lindex $testref 0]
+        puts -nonewline "testing href=$href "
+        RobotHref t href host path
+        if {[string compare $path [lindex $testref 1]]} {
+            puts "failed"
+            puts "  href=$href"
+            puts "  host=$host"
+            puts "  path=$path"
+        } else {
+            puts "OK"
+        }
+    }
+    foreach testref {
+        {../../k.htm /k.htm}
+        {../k.htm /k.htm}
+        {k.htm /pages/k.htm} 
+        {../../peter/k.htm /peter/k.htm}
+        {../../ /}
+        {/../k.htm /k.htm}
+        {/./../.././k.htm /k.htm}
+        {../.. /}} {
+        set URL(t,hostport) http://bilbasen.tv2.dk
+        set URL(t,path) /pages/not_good.asp
+        set href [lindex $testref 0]
+        puts -nonewline "testing href=$href "
+        RobotHref t href host path
+        if {[string compare $path [lindex $testref 1]]} {
+            puts "failed"
+            puts "  href=$href"
+            puts "  host=$host"
+            puts "  path=$path"
+        } else {
+            puts "OK"
+        }
+    }
+    foreach testref {
+        {../../k.htm /k.htm}
+        {../k.htm /k.htm}
+        {k.htm /pages/k.htm} 
+        {../../peter/k.htm /peter/k.htm}
+        {../../ /}
+        {../.. /}} {
+        set URL(t,hostport) http://bilbasen.tv2.dk
+        set URL(t,path) /pages/
+        set href [lindex $testref 0]
+        puts -nonewline "testing href=$href "
+        RobotHref t href host path
+        if {[string compare $path [lindex $testref 1]]} {
+            puts "failed"
+            puts "  href=$href"
+            puts "  host=$host"
+            puts "  path=$path"
+        } else {
+            puts "OK"
+        }
+    }
+}
+testhref
+   
+exit 0
+
+