summaryrefslogtreecommitdiffstats
path: root/tests/httpold.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2002-07-05 10:38:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2002-07-05 10:38:42 (GMT)
commita407e1e0a4496d94823146e2bacf89ba0d5634f5 (patch)
treebaa4c102aff8ec62a52114ea6ce1cacb8237f8c7 /tests/httpold.test
parentc8b71f046baf06c64c0bb2e7c5c295b0fc742f5e (diff)
downloadtcl-a407e1e0a4496d94823146e2bacf89ba0d5634f5.zip
tcl-a407e1e0a4496d94823146e2bacf89ba0d5634f5.tar.gz
tcl-a407e1e0a4496d94823146e2bacf89ba0d5634f5.tar.bz2
Made many tests work properly when the current directory is not writable.
Added targets to unix/Makefile.in to facilitate testing of this situation.
Diffstat (limited to 'tests/httpold.test')
-rw-r--r--tests/httpold.test85
1 files changed, 44 insertions, 41 deletions
diff --git a/tests/httpold.test b/tests/httpold.test
index 8cdb9d8..feb555a 100644
--- a/tests/httpold.test
+++ b/tests/httpold.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: httpold.test,v 1.9 2002/06/22 04:19:47 dgp Exp $
+# RCS: @(#) $Id: httpold.test,v 1.10 2002/07/05 10:38:42 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -51,19 +51,19 @@ if [catch {httpd_init $port} listen] {
return
}
-test http-1.1 {http_config} {
+test httpold-1.1 {http_config} {
http_config
} {-accept */* -proxyfilter httpProxyRequired -proxyhost {} -proxyport {} -useragent {Tcl http client package 1.0}}
-test http-1.2 {http_config} {
+test httpold-1.2 {http_config} {
http_config -proxyfilter
} httpProxyRequired
-test http-1.3 {http_config} {
+test httpold-1.3 {http_config} {
catch {http_config -junk}
} 1
-test http-1.4 {http_config} {
+test httpold-1.4 {http_config} {
http_config -proxyhost nowhere.come -proxyport 8080 -proxyfilter myFilter -useragent "Tcl Test Suite"
set x [http_config]
http_config -proxyhost {} -proxyport {} -proxyfilter httpProxyRequired \
@@ -71,24 +71,24 @@ test http-1.4 {http_config} {
set x
} {-accept */* -proxyfilter myFilter -proxyhost nowhere.come -proxyport 8080 -useragent {Tcl Test Suite}}
-test http-1.5 {http_config} {
+test httpold-1.5 {http_config} {
catch {http_config -proxyhost {} -junk 8080}
} 1
-test http-2.1 {http_reset} {
+test httpold-2.1 {http_reset} {
catch {http_reset http#1}
} 0
-test http-3.1 {http_get} {
+test httpold-3.1 {http_get} {
catch {http_get -bogus flag}
} 1
-test http-3.2 {http_get} {
+test httpold-3.2 {http_get} {
catch {http_get http:junk} err
set err
} {Unsupported URL: http:junk}
set url [info hostname]:$port
-test http-3.3 {http_get} {
+test httpold-3.3 {http_get} {
set token [http_get $url]
http_data $token
} "<html><head><title>HTTP/1.0 TEST</title></head><body>
@@ -100,7 +100,7 @@ set tail /a/b/c
set url [info hostname]:$port/a/b/c
set binurl [info hostname]:$port/binary
-test http-3.4 {http_get} {
+test httpold-3.4 {http_get} {
set token [http_get $url]
http_data $token
} "<html><head><title>HTTP/1.0 TEST</title></head><body>
@@ -112,7 +112,7 @@ proc selfproxy {host} {
global port
return [list [info hostname] $port]
}
-test http-3.5 {http_get} {
+test httpold-3.5 {http_get} {
http_config -proxyfilter selfproxy
set token [http_get $url]
http_config -proxyfilter httpProxyRequired
@@ -122,7 +122,7 @@ test http-3.5 {http_get} {
<h2>GET http://$url</h2>
</body></html>"
-test http-3.6 {http_get} {
+test httpold-3.6 {http_get} {
http_config -proxyfilter bogus
set token [http_get $url]
http_config -proxyfilter httpProxyRequired
@@ -132,7 +132,7 @@ test http-3.6 {http_get} {
<h2>GET $tail</h2>
</body></html>"
-test http-3.7 {http_get} {
+test httpold-3.7 {http_get} {
set token [http_get $url -headers {Pragma no-cache}]
http_data $token
} "<html><head><title>HTTP/1.0 TEST</title></head><body>
@@ -140,7 +140,7 @@ test http-3.7 {http_get} {
<h2>GET $tail</h2>
</body></html>"
-test http-3.8 {http_get} {
+test httpold-3.8 {http_get} {
set token [http_get $url -query Name=Value&Foo=Bar]
http_data $token
} "<html><head><title>HTTP/1.0 TEST</title></head><body>
@@ -153,63 +153,66 @@ test http-3.8 {http_get} {
</dl>
</body></html>"
-test http-3.9 {http_get} {
+test httpold-3.9 {http_get} {
set token [http_get $url -validate 1]
http_code $token
} "HTTP/1.0 200 OK"
-test http-4.1 {httpEvent} {
+test httpold-4.1 {httpEvent} {
set token [http_get $url]
upvar #0 $token data
array set meta $data(meta)
expr ($data(totalsize) == $meta(Content-Length))
} 1
-test http-4.2 {httpEvent} {
+test httpold-4.2 {httpEvent} {
set token [http_get $url]
upvar #0 $token data
array set meta $data(meta)
string compare $data(type) [string trim $meta(Content-Type)]
} 0
-test http-4.3 {httpEvent} {
+test httpold-4.3 {httpEvent} {
set token [http_get $url]
http_code $token
} {HTTP/1.0 200 Data follows}
-test http-4.4 {httpEvent} {
- set out [open testfile w]
+test httpold-4.4 {httpEvent} {
+ set testfile [makeFile "" testfile]
+ set out [open $testfile w]
set token [http_get $url -channel $out]
close $out
- set in [open testfile]
+ set in [open $testfile]
set x [read $in]
close $in
- file delete testfile
+ removeFile $testfile
set x
} "<html><head><title>HTTP/1.0 TEST</title></head><body>
<h1>Hello, World!</h1>
<h2>GET $tail</h2>
</body></html>"
-test http-4.5 {httpEvent} {
- set out [open testfile w]
+test httpold-4.5 {httpEvent} {
+ set testfile [makeFile "" testfile]
+ set out [open $testfile w]
set token [http_get $url -channel $out]
close $out
upvar #0 $token data
- file delete testfile
+ removeFile $testfile
expr $data(currentsize) == $data(totalsize)
} 1
-test http-4.6 {httpEvent} {
- set out [open testfile w]
+test httpold-4.6 {httpEvent} {
+ set testfile [makeFile "" testfile]
+ set out [open $testfile w]
set token [http_get $binurl -channel $out]
close $out
- set in [open testfile]
+ set in [open $testfile]
fconfigure $in -translation binary
set x [read $in]
close $in
- file delete testfile
+ removeFile $testfile
set x
} "$bindata$binurl"
@@ -223,33 +226,33 @@ proc myProgress {token total current} {
if 0 {
# This test hangs on Windows95 because the client never gets EOF
set httpLog 1
- test http-4.6 {httpEvent} {
+ test httpold-4.6 {httpEvent} {
set token [http_get $url -blocksize 50 -progress myProgress]
set progress
} {111 111}
}
-test http-4.7 {httpEvent} {
+test httpold-4.7 {httpEvent} {
set token [http_get $url -progress myProgress]
set progress
} {111 111}
-test http-4.8 {httpEvent} {
+test httpold-4.8 {httpEvent} {
set token [http_get $url]
http_status $token
} {ok}
-test http-4.9 {httpEvent} {
+test httpold-4.9 {httpEvent} {
set token [http_get $url -progress myProgress]
http_code $token
} {HTTP/1.0 200 Data follows}
-test http-4.10 {httpEvent} {
+test httpold-4.10 {httpEvent} {
set token [http_get $url -progress myProgress]
http_size $token
} {111}
-test http-4.11 {httpEvent} {
+test httpold-4.11 {httpEvent} {
set token [http_get $url -timeout 1 -command {#}]
http_reset $token
http_status $token
} {reset}
-test http-4.12 {httpEvent} {
+test httpold-4.12 {httpEvent} {
update
set x {}
after 500 {lappend x ok}
@@ -258,19 +261,19 @@ test http-4.12 {httpEvent} {
list [http_status $token] $x
} {timeout ok}
-test http-5.1 {http_formatQuery} {
+test httpold-5.1 {http_formatQuery} {
http_formatQuery name1 value1 name2 "value two"
} {name1=value1&name2=value+two}
-test http-5.2 {http_formatQuery} {
+test httpold-5.2 {http_formatQuery} {
http_formatQuery name1 ~bwelch name2 \xa1\xa2\xa2
} {name1=%7ebwelch&name2=%a1%a2%a2}
-test http-5.3 {http_formatQuery} {
+test httpold-5.3 {http_formatQuery} {
http_formatQuery lines "line1\nline2\nline3"
} {lines=line1%0d%0aline2%0d%0aline3}
-test http-6.1 {httpProxyRequired} {
+test httpold-6.1 {httpProxyRequired} {
update
http_config -proxyhost [info hostname] -proxyport $port
set token [http_get $url]