From 09c38dc810f79cf64656ebc5138a8d7890ac08c4 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 8 Nov 2001 14:22:21 +0000 Subject: [PATCH] Added tests script. --- tests.tcl | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 tests.tcl diff --git a/tests.tcl b/tests.tcl new file mode 100644 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 + + -- 1.7.10.4