Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25378/tests Added Files: ns_conn.test ns_crypt.test ns_env.test ns_gifsize.test ns_info.test ns_httptime.test ns_jpegsize.test ns_mime.test ns_sha1.test Log Message: see ChangeLog --- NEW FILE: ns_info.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_info.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_info-1.1 {basic syntax: plain call} -body { ns_info } -returnCodes error -result {wrong # args: should be "ns_info option"} test ns_info-1.2 {basic syntax: wrong argument} -body { ns_info 123 } -returnCodes error -result {bad option "123": must be address, argv0, boottime, builddate, callbacks, config, home, hostname, locks, log, major, minor, name, nsd, pageroot, patchlevel, pid, platform, pools, scheduled, server, servers, sockcallbacks, tag, tcllib, threads, uptime, version, winnt, filters, traces, or requestprocs} test ns_info-2.1.1 {basic operation} -body { ns_info address } -match "glob" -result "*.*.*.*" test ns_info-2.2.1 {basic operation} -body { ns_info argv0 } -result "./nsd/nsd" test ns_info-2.3.1 {basic operation} -body { string is int -strict [ns_info boottime] } -result 1 test ns_info-2.4.1 {basic operation builddate: positive if builddate = day of test} -body { foreach {month day year blub time} [split [ns_info builddate]] {break} set _todaybuilt [clock format [clock scan "$month $day $year"] -format "%d"] set _todaydate [clock format [clock scan "today"] -format "%d"] expr {$_todaybuilt == $_todaydate} } -result 1 test ns_info-2.5.1 {basic operation} -body { string is int -strict [llength [ns_info callbacks]] } -result 1 test ns_info-2.6.1 {basic operation} -body { ns_info config } -match "glob" -result "*.nscfg" test ns_info-2.7.1 {basic operation} -body { expr {[string length [ns_info home]]>1} } -result 1 test ns_info-2.8.1 {basic operation} -setup { set hostname_by_exec [exec hostname] } -body { string match [ns_info hostname] $hostname_by_exec } -result 1 test ns_info-2.9.1 {basic operation} -body { expr {[llength [ns_info locks]]>0} } -result 1 test ns_info-2.10.1 {basic operation} -body { expr {[file tail [ns_info log]] ne ""} } -result 1 test ns_info-2.11.1 {basic operation} -body { ns_info major } -result 4 test ns_info-2.12.1 {basic operation} -body { ns_info minor } -result 99 test ns_info-2.13.1 {basic operation} -body { ns_info name } -result "NaviServer" test ns_info-2.14.1 {basic operation} -body { file tail [ns_info nsd] } -result "nsd" test ns_info-2.15.1 {basic operation} -body { expr {[llength [split [ns_info pageroot] "/"]]>1} } -result 1 test ns_info-2.16.1 {basic operation} -body { ns_info patchlevel } -match "glob" -result "4.99.*" test ns_info-2.17.1 {basic operation} -body { expr {[ns_info pid] == [pid]} } -result 1 test ns_info-2.18.1 {basic operation} -body { expr {[ns_info platform] ne ""} } -result 1 test ns_info-2.19.1 {basic operation} -body { expr {[llength [ns_info pools]]>0} } -result 1 test ns_info-2.20.1 {basic operation} -body { string is int -strict [llength [ns_info scheduled]] } -result 1 test ns_info-2.21.1 {basic operation} -body { ns_info server } -result "test" test ns_info-2.22.1 {basic operation} -body { ns_info servers } -match "regexp" -result "testvhost|testvhost2|test" test ns_info-2.23.1 {basic operation} -body { ns_info sockcallbacks } -result "" test ns_info-2.24.1 {basic operation} -body { ns_info tag } -match "glob" -result "*Name*" test ns_info-2.25.1 {basic operation} -body { ns_info tcllib } -match "glob" -result "*modules*" test ns_info-2.26.1 {basic operation} -body { expr {[llength [ns_info threads]]>2} } -result 1 test ns_info-2.27.1 {basic operation} -body { set expected_threads 0 foreach _thread [ns_info threads] { switch -- [lindex $_thread 0] { "-driver-" - "-sched-" - "-main-" {} "default" { set expected_threads 1 } } } set expected_threads } -result 1 test ns_info-2.28.1 {basic operation} -body { expr {[ns_info uptime]>1} } -result 1 test ns_info-2.29.1 {basic operation} -body { ns_info version } -result "4.99" test ns_info-2.30.1 {basic operation} -body { string is int -strict [ns_info winnt] } -result 1 test ns_info-2.31.1 {basic operation} -body { ns_info filters } -result "" test ns_info-2.31.2 {basic operation} -setup { proc _filter_do_nothing {args} { return "" } ns_register_filter preauth GET / _filter_do_nothing } -body { ns_info filters } -result {{GET / preauth ns:tclfilter _filter_do_nothing {}}} test ns_info-2.32.1 {basic operation} -body { expr {[llength [ns_info traces]]>-1} } -result 1 test ns_info-2.33.1 {basic operation} -body { expr {[llength [ns_info requestprocs]]>0} } -result 1 cleanupTests --- NEW FILE: ns_sha1.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_sha1.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_sha1-1.1 {basic syntax: plain call} -body { ns_sha1 } -returnCodes error -result {wrong # args: should be "ns_sha1 string"} test ns_sha1-1.2 {basic syntax: plain call} -body { ns_sha1 } -returnCodes error -result {wrong # args: should be "ns_sha1 string"} test ns_sha1-2.1 {basic operation} -body { ns_sha1 foo } -result "0BEEC7B5EA3F0FDBC95D0DD47F3C5BC275DA8A33" test ns_sha1-2.2 {basic operation} -body { for {set i 0} {$i < 999} {incr i +1} { set nssha1([ns_sha1 foo]) . } llength [array names nssha1] } -cleanup { array unset nssha1 } -result 1 test ns_sha1-2.3 {basic operation} -body { for {set i 0} {$i < 999} {incr i +1} { set nssha1([ns_sha1 $i]) . } llength [array names nssha1] } -cleanup { array unset nssha1 } -result 999 test ns_sha1-2.4 {basic operation} -body { set hash1 [ns_sha1 ""] set hash2 [ns_sha1 {}] set hash3 [ns_sha1 [array names fjfjfjfjfj]] expr {($hash1 eq $hash2) == ($hash2 eq $hash3)} } -result 1 cleanupTests --- NEW FILE: ns_conn.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_conn.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_conn-1.1 {basic syntax: plain call} -body { ns_conn } -returnCodes error -result {wrong # args: should be "ns_conn option"} test ns_conn-1.2 {basic syntax: wrong argument} -body { ns_conn 123 } -returnCodes error -result {bad option "123": must be authpassword, authuser, close, content, contentlength, copy, channel, driver, encoding, files, fileoffset, filelength, fileheaders, flags, form, headers, host, id, isconnected, location, method, outputheaders, peeraddr, peerport, port, protocol, query, request, server, sock, start, status, url, urlc, urlencoding, urlv, version, write_encoded, chunked, or responseversion} test ns_conn-2.1 {basic operation} -body { ns_conn close } -returnCodes error -result {no current connection} cleanupTests --- NEW FILE: ns_jpegsize.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_jpegsize.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # # Thanks to Michael P. Lex (Kinetiqa) # package require tcltest 2.2 namespace import -force ::tcltest::* set home [ns_config test home] if {[file exists "${home}/images/empty.jpg"] && [file readable "${home}/images/empty.jpg"]} { testConstraint fileExistsEmpty true } if {[file exists "${home}/images/broken.jpg"] && [file readable "${home}/images/broken.jpg"]} { testConstraint fileExistsBroken true } if {[file exists "${home}/images/color5x200.jpg"] && [file readable "${home}/images/color5x200.jpg"]} { testConstraint fileExistsColor true } if {[file exists "${home}/images/color5x200_progressive.jpg"] && [file readable "${home}/images/color5x200_progressive.jpg"]} { testConstraint fileExistsProgressive true } test ns_jpegsize-1.1 {syntax} -body { ns_jpegsize } -returnCodes error -result {wrong # args: should be "ns_jpegsize jpeg_file"} test ns_jpegsize-2.1 {file does not exist} -body { ns_jpegsize "${home}/images/noexist.jpg" } -returnCodes error -match "glob" -result {couldn't open "*": no such file or directory} test ns_jpegsize-2.2 {file is empty} -constraints fileExistsEmpty -body { ns_jpegsize "${home}/images/empty.jpg" } -returnCodes error -match "glob" -result {invalid jpeg file*} test ns_jpegsize-2.3 {file is broken} -constraints fileExistsBroken -body { ns_jpegsize "${home}/images/broken.jpg" } -returnCodes error -match "glob" -result {invalid jpeg file*} test ns_jpegsize-2.4 {normal jpeg} -constraints fileExistsColor -body { ns_jpegsize "${home}/images/color5x200.jpg" } -result [list 5 200] test ns_jpegsize-2.5 {normal progressive jpeg} -constraints fileExistsProgressive -body { ns_jpegsize "${home}/images/color5x200_progressive.jpg" } -result [list 5 200] cleanupTests --- NEW FILE: ns_env.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_env.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_env-1.1 {basic syntax} -body { ns_env } -returnCodes error -result {wrong # args: should be "ns_env command ?args ...?"} test ns_env-1.2 {basic syntax} -body { ns_env 123 } -returnCodes error -result {unknown command "123": should be exists, names, get, set, or unset} test ns_env-1.3 {basic syntax} -body { ns_env get } -returnCodes error -result {wrong # args: should be "ns_env get ?-nocomplain? name"} test ns_env-2.1 {basic operation: set, exists} -setup { ns_env set foo bar } -body { ns_env exists foo } -cleanup { ns_env unset foo } -result 1 test ns_env-2.2 {basic operation: set, get} -setup { ns_env set foo bar } -body { ns_env get foo } -cleanup { ns_env unset foo } -result "bar" test ns_env-2.3 {basic operation: unset} -setup { ns_env set foo bar } -body { ns_env unset foo ns_env exists foo } -result 0 test ns_env-2.4 {basic operation: names} -setup { ns_env set zhzhzhzh bar } -body { expr {[lsearch -exact [ns_env names] "zhzhzhzh"]>-1} } -result 1 test ns_env-2.5 {basic operation: get -nocomplain} -body { # note that this throws an error but the test case # tests the implied behaviour ns_env get -nocomplain NXNXNXNX } -result "" test ns_env-2.6 {basic operation: get} -body { # note that the test case expects the implied behaviour ns_env get NXNXNXNX } -returnCodes error -result {no such environment variable: NXNXNXNX} cleanupTests --- NEW FILE: ns_crypt.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_crypt.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_crypt-1.1 {basic syntax: plain call} -body { ns_crypt } -returnCodes error -result {wrong # args: should be "ns_crypt key salt"} test ns_crypt-1.2 {basic syntax: only key} -body { ns_crypt 123 } -returnCodes error -result {wrong # args: should be "ns_crypt key salt"} test ns_crypt-1.3 {basic syntax: key but empty salt argument} -body { ns_crypt 123 "" } -result "" test ns_crypt-1.4 {basic syntax: empty key but salt argument} -body { ns_crypt "" 12 } -result "12UFlHxel6uMM" test ns_crypt-1.5 {basic syntax: empty args} -body { ns_crypt "" "" } -result "" test ns_crypt-2.1 {basic operation} -body { ns_crypt foo ba } -result "ba4TuD1iozTxw" test ns_crypt-2.2 {basic operation} -body { for {set i 0} {$i < 999} {incr i +1} { set nscrypt([ns_crypt foo ba]) . } llength [array names nscrypt] } -cleanup { array unset nscrypt } -result 1 test ns_crypt-2.3 {basic operation} -body { for {set i 0} {$i < 99} {incr i +1} { set nscrypt([ns_crypt "foo" $i]) . } llength [array names nscrypt] } -cleanup { array unset nscrypt } -result 99 test ns_crypt-3.1 {usability for *nix like passwords: basic} -body { ns_crypt mypassword XL } -result "XL/CpuZPF/frI" test ns_crypt-3.1 {usability for *nix like passwords: length} -body { string length [ns_crypt mypassword XL] } -result 13 test ns_crypt-3.1 {usability for *nix like passwords: salt} -body { string range [ns_crypt mypassword XL] 0 1 } -result "XL" cleanupTests --- NEW FILE: ns_mime.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_mime.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_uuencode-1.1 {basic syntax: plain call} -body { ns_uuencode } -returnCodes error -result {wrong # args: should be "ns_uuencode string"} test ns_uudecode-1.2 {basic syntax: plain call} -body { ns_uudecode } -returnCodes error -result {wrong # args: should be "ns_uudecode string"} test ns_base64encode-1.3 {basic syntax: plain call} -body { ns_base64encode } -returnCodes error -result {wrong # args: should be "ns_base64encode string"} test ns_base64decode-1.4 {basic syntax: plain call} -body { ns_base64decode } -returnCodes error -result {wrong # args: should be "ns_base64decode string"} test ns_uuencode-2.1 {basic operation ns_uuencode} -body { ns_uuencode "true friends stab you in the front" } -result "dHJ1ZSBmcmllbmRzIHN0YWIgeW91IGluIHRoZSBmcm9udA==" test ns_uudecode-2.2 {basic operation ns_uudecode} -body { ns_uudecode "dHJ1ZSBmcmllbmRzIHN0YWIgeW91IGluIHRoZSBmcm9udA==" } -result "true friends stab you in the front" test ns_base64encode-3.1 {basic operation ns_base64encode} -body { ns_base64encode "true friends stab you in the front" } -result "dHJ1ZSBmcmllbmRzIHN0YWIgeW91IGluIHRoZSBmcm9udA==" test ns_base64decode-3.2 {basic operation ns_base64decode} -body { ns_base64decode "dHJ1ZSBmcmllbmRzIHN0YWIgeW91IGluIHRoZSBmcm9udA==" } -result "true friends stab you in the front" #test ns_uuencode-4.1 {basic operation: caused server abort} -body { # ns_uuencode @ #} -match "glob" -result "*" test ns_guesstype-5.1 {basic syntax: ns_guesstype} -body { ns_guesstype } -returnCodes error -result {wrong # args: should be "ns_guesstype filename"} test ns_guesstype-5.2 {basic syntax: ns_guesstype} -body { ns_guesstype x } -result "*/*" test ns_guesstype-6.1 {basic operation: ns_guesstype} -body { ns_guesstype "filename.adp" } -match "glob" -result "text/html;*" test ns_guesstype-6.2 {basic operation: ns_guesstype} -body { ns_guesstype "filename.dci" } -match "glob" -result "text/html;*" test ns_guesstype-6.3 {basic operation: ns_guesstype} -body { ns_guesstype "filename.htm" } -match "glob" -result "text/html;*" test ns_guesstype-6.4 {basic operation: ns_guesstype} -body { ns_guesstype "filename.html" } -match "glob" -result "text/html;*" test ns_guesstype-6.5 {basic operation: ns_guesstype} -body { ns_guesstype "filename.sht" } -match "glob" -result "text/html;*" test ns_guesstype-6.6 {basic operation: ns_guesstype} -body { ns_guesstype "filename.shtml" } -match "glob" -result "text/html;*" test ns_guesstype-6.7 {basic operation: ns_guesstype with extension .323} -body { ns_guesstype "filename.323" } -match "glob" -result "text/h323*" test ns_guesstype-6.8 {basic operation: ns_guesstype with extension .ai} -body { ns_guesstype "filename.ai" } -match "glob" -result "application/postscript*" test ns_guesstype-6.9 {basic operation: ns_guesstype with extension .aif} -body { ns_guesstype "filename.aif" } -match "glob" -result "audio/aiff*" test ns_guesstype-6.10 {basic operation: ns_guesstype with extension .aifc} -body { ns_guesstype "filename.aifc" } -match "glob" -result "audio/aiff*" test ns_guesstype-6.11 {basic operation: ns_guesstype with extension .aiff} -body { ns_guesstype "filename.aiff" } -match "glob" -result "audio/aiff*" test ns_guesstype-6.12 {basic operation: ns_guesstype with extension .ani} -body { ns_guesstype "filename.ani" } -match "glob" -result "application/x-navi-animation*" test ns_guesstype-6.13 {basic operation: ns_guesstype with extension .art} -body { ns_guesstype "filename.art" } -match "glob" -result "image/x-art*" test ns_guesstype-6.14 {basic operation: ns_guesstype with extension .asf} -body { ns_guesstype "filename.asf" } -match "glob" -result "video/x-ms-asf*" test ns_guesstype-6.15 {basic operation: ns_guesstype with extension .asr} -body { ns_guesstype "filename.asr" } -match "glob" -result "video/x-ms-asf*" test ns_guesstype-6.16 {basic operation: ns_guesstype with extension .asx} -body { ns_guesstype "filename.asx" } -match "glob" -result "video/x-ms-asf*" test ns_guesstype-6.17 {basic operation: ns_guesstype with extension .atom} -body { ns_guesstype "filename.atom" } -match "glob" -result "application/atom+xml*" test ns_guesstype-6.18 {basic operation: ns_guesstype with extension .au} -body { ns_guesstype "filename.au" } -match "glob" -result "audio/basic*" test ns_guesstype-6.19 {basic operation: ns_guesstype with extension .avi} -body { ns_guesstype "filename.avi" } -match "glob" -result "video/x-msvideo*" test ns_guesstype-6.20 {basic operation: ns_guesstype with extension .bin} -body { ns_guesstype "filename.bin" } -match "glob" -result "application/x-macbinary*" test ns_guesstype-6.21 {basic operation: ns_guesstype with extension .bmp} -body { ns_guesstype "filename.bmp" } -match "glob" -result "image/bmp*" test ns_guesstype-6.22 {basic operation: ns_guesstype with extension .cer} -body { ns_guesstype "filename.cer" } -match "glob" -result "application/x-x509-ca-cert*" test ns_guesstype-6.23 {basic operation: ns_guesstype with extension .class} -body { ns_guesstype "filename.class" } -match "glob" -result "application/octet-stream*" test ns_guesstype-6.24 {basic operation: ns_guesstype with extension .cpio} -body { ns_guesstype "filename.cpio" } -match "glob" -result "application/x-cpio*" test ns_guesstype-6.25 {basic operation: ns_guesstype with extension .css} -body { ns_guesstype "filename.css" } -match "glob" -result "text/css*" test ns_guesstype-6.26 {basic operation: ns_guesstype with extension .csv} -body { ns_guesstype "filename.csv" } -match "glob" -result "text/csv*" test ns_guesstype-6.27 {basic operation: ns_guesstype with extension .dcr} -body { ns_guesstype "filename.dcr" } -match "glob" -result "application/x-director*" test ns_guesstype-6.28 {basic operation: ns_guesstype with extension .der} -body { ns_guesstype "filename.der" } -match "glob" -result "application/x-x509-ca-cert*" test ns_guesstype-6.29 {basic operation: ns_guesstype with extension .dia} -body { ns_guesstype "filename.dia" } -match "glob" -result "application/x-dia*" test ns_guesstype-6.30 {basic operation: ns_guesstype with extension .dir} -body { ns_guesstype "filename.dir" } -match "glob" -result "application/x-director*" test ns_guesstype-6.31 {basic operation: ns_guesstype with extension .doc} -body { ns_guesstype "filename.doc" } -match "glob" -result "application/msword*" test ns_guesstype-6.32 {basic operation: ns_guesstype with extension .dot} -body { ns_guesstype "filename.dot" } -match "glob" -result "application/msword*" test ns_guesstype-6.33 {basic operation: ns_guesstype with extension .dp} -body { ns_guesstype "filename.dp" } -match "glob" -result "application/commonground*" test ns_guesstype-6.34 {basic operation: ns_guesstype with extension .dtd} -body { ns_guesstype "filename.dtd" } -match "glob" -result "application/xml-dtd*" test ns_guesstype-6.35 {basic operation: ns_guesstype with extension .dxr} -body { ns_guesstype "filename.dxr" } -match "glob" -result "application/x-director*" test ns_guesstype-6.36 {basic operation: ns_guesstype with extension .elm} -body { ns_guesstype "filename.elm" } -match "glob" -result "text/plain*" test ns_guesstype-6.37 {basic operation: ns_guesstype with extension .eml} -body { ns_guesstype "filename.eml" } -match "glob" -result "text/plain*" test ns_guesstype-6.38 {basic operation: ns_guesstype with extension .eps} -body { ns_guesstype "filename.eps" } -match "glob" -result "application/postscript*" test ns_guesstype-6.39 {basic operation: ns_guesstype with extension .exe} -body { ns_guesstype "filename.exe" } -match "glob" -result "application/octet-stream*" test ns_guesstype-6.40 {basic operation: ns_guesstype with extension .gbt} -body { ns_guesstype "filename.gbt" } -match "glob" -result "text/plain*" test ns_guesstype-6.41 {basic operation: ns_guesstype with extension .gif} -body { ns_guesstype "filename.gif" } -match "glob" -result "image/gif*" test ns_guesstype-6.42 {basic operation: ns_guesstype with extension .gz} -body { ns_guesstype "filename.gz" } -match "glob" -result "application/x-compressed*" test ns_guesstype-6.43 {basic operation: ns_guesstype with extension .h} -body { ns_guesstype "filename.h" } -match "glob" -result "text/plain*" test ns_guesstype-6.44 {basic operation: ns_guesstype with extension .hqx} -body { ns_guesstype "filename.hqx" } -match "glob" -result "application/mac-binhex40*" test ns_guesstype-6.45 {basic operation: ns_guesstype with extension .ico} -body { ns_guesstype "filename.ico" } -match "glob" -result "image/x-icon*" test ns_guesstype-6.46 {basic operation: ns_guesstype with extension .ica} -body { ns_guesstype "filename.ica" } -match "glob" -result "application/x-ica*" test ns_guesstype-6.47 {basic operation: ns_guesstype with extension .ics} -body { ns_guesstype "filename.ics" } -match "glob" -result "text/calendar*" test ns_guesstype-6.48 {basic operation: ns_guesstype with extension .ifb} -body { ns_guesstype "filename.ifb" } -match "glob" -result "text/calendar*" test ns_guesstype-6.49 {basic operation: ns_guesstype with extension .jar} -body { ns_guesstype "filename.jar" } -match "glob" -result "application/x-java-archive*" test ns_guesstype-6.50 {basic operation: ns_guesstype with extension .jfif} -body { ns_guesstype "filename.jfif" } -match "glob" -result "image/jpeg*" test ns_guesstype-6.51 {basic operation: ns_guesstype with extension .jng} -body { ns_guesstype "filename.jng" } -match "glob" -result "image/x-jng*" test ns_guesstype-6.52 {basic operation: ns_guesstype with extension .jpe} -body { ns_guesstype "filename.jpe" } -match "glob" -result "image/jpeg*" test ns_guesstype-6.53 {basic operation: ns_guesstype with extension .jpg} -body { ns_guesstype "filename.jpg" } -match "glob" -result "image/jpeg*" test ns_guesstype-6.54 {basic operation: ns_guesstype with extension .jpeg} -body { ns_guesstype "filename.jpeg" } -match "glob" -result "image/jpeg*" test ns_guesstype-6.55 {basic operation: ns_guesstype with extension .js} -body { ns_guesstype "filename.js" } -match "glob" -result "application/x-javascript*" test ns_guesstype-6.56 {basic operation: ns_guesstype with extension .ls} -body { ns_guesstype "filename.ls" } -match "glob" -result "application/x-javascript*" test ns_guesstype-6.57 {basic operation: ns_guesstype with extension .m3u} -body { ns_guesstype "filename.m3u" } -match "glob" -result "audio/x-mpegurl*" test ns_guesstype-6.58 {basic operation: ns_guesstype with extension .m4a} -body { ns_guesstype "filename.m4a" } -match "glob" -result "audio/mp4*" test ns_guesstype-6.59 {basic operation: ns_guesstype with extension .m4p} -body { ns_guesstype "filename.m4p" } -match "glob" -result "audio/mp4*" test ns_guesstype-6.60 {basic operation: ns_guesstype with extension .man} -body { ns_guesstype "filename.man" } -match "glob" -result "application/x-troff-man*" test ns_guesstype-6.61 {basic operation: ns_guesstype with extension .map} -body { ns_guesstype "filename.map" } -match "glob" -result "application/x-navimap*" test ns_guesstype-6.62 {basic operation: ns_guesstype with extension .mdb} -body { ns_guesstype "filename.mdb" } -match "glob" -result "application/x-msaccess*" test ns_guesstype-6.63 {basic operation: ns_guesstype with extension .mid} -body { ns_guesstype "filename.mid" } -match "glob" -result "audio/x-midi*" test ns_guesstype-6.64 {basic operation: ns_guesstype with extension .midi} -body { ns_guesstype "filename.midi" } -match "glob" -result "audio/x-midi*" test ns_guesstype-6.65 {basic operation: ns_guesstype with extension .mng} -body { ns_guesstype "filename.mng" } -match "glob" -result "image/x-mng*" test ns_guesstype-6.66 {basic operation: ns_guesstype with extension .mocha} -body { ns_guesstype "filename.mocha" } -match "glob" -result "application/x-javascript*" test ns_guesstype-6.67 {basic operation: ns_guesstype with extension .mov} -body { ns_guesstype "filename.mov" } -match "glob" -result "video/quicktime*" test ns_guesstype-6.68 {basic operation: ns_guesstype with extension .mp2} -body { ns_guesstype "filename.mp2" } -match "glob" -result "audio/mpeg*" test ns_guesstype-6.69 {basic operation: ns_guesstype with extension .mp3} -body { ns_guesstype "filename.mp3" } -match "glob" -result "audio/mpeg*" test ns_guesstype-6.70 {basic operation: ns_guesstype with extension .mp4} -body { ns_guesstype "filename.mp4" } -match "glob" -result "audio/mp4*" test ns_guesstype-6.71 {basic operation: ns_guesstype with extension .mpe} -body { ns_guesstype "filename.mpe" } -match "glob" -result "video/mpeg*" test ns_guesstype-6.72 {basic operation: ns_guesstype with extension .mpeg} -body { ns_guesstype "filename.mpeg" } -match "glob" -result "video/mpeg*" test ns_guesstype-6.73 {basic operation: ns_guesstype with extension .mpg} -body { ns_guesstype "filename.mpg" } -match "glob" -result "video/mpeg*" test ns_guesstype-6.74 {basic operation: ns_guesstype with extension .mpga} -body { ns_guesstype "filename.mpga" } -match "glob" -result "video/mpeg*" test ns_guesstype-6.75 {basic operation: ns_guesstype with extension .mpv2} -body { ns_guesstype "filename.mpv2" } -match "glob" -result "video/mpeg*" test ns_guesstype-6.76 {basic operation: ns_guesstype with extension .mxu} -body { ns_guesstype "filename.mxu" } -match "glob" -result "video/vnd.mpegurl*" test ns_guesstype-6.77 {basic operation: ns_guesstype with extension .nvd} -body { ns_guesstype "filename.nvd" } -match "glob" -result "application/x-navidoc*" test ns_guesstype-6.78 {basic operation: ns_guesstype with extension .nvm} -body { ns_guesstype "filename.nvm" } -match "glob" -result "application/x-navimap*" test ns_guesstype-6.79 {basic operation: ns_guesstype with extension .ogg} -body { ns_guesstype "filename.ogg" } -match "glob" -result "application/ogg*" test ns_guesstype-6.80 {basic operation: ns_guesstype with extension .pbm} -body { ns_guesstype "filename.pbm" } -match "glob" -result "image/x-portable-bitmap*" test ns_guesstype-6.81 {basic operation: ns_guesstype with extension .pdf} -body { ns_guesstype "filename.pdf" } -match "glob" -result "application/pdf*" test ns_guesstype-6.82 {basic operation: ns_guesstype with extension .pgm} -body { ns_guesstype "filename.pgm" } -match "glob" -result "image/x-portable-graymap*" test ns_guesstype-6.83 {basic operation: ns_guesstype with extension .pic} -body { ns_guesstype "filename.pic" } -match "glob" -result "image/pict*" test ns_guesstype-6.84 {basic operation: ns_guesstype with extension .pict} -body { ns_guesstype "filename.pict" } -match "glob" -result "image/pict*" test ns_guesstype-6.85 {basic operation: ns_guesstype with extension .pnm} -body { ns_guesstype "filename.pnm" } -match "glob" -result "image/x-portable-anymap*" test ns_guesstype-6.86 {basic operation: ns_guesstype with extension .png} -body { ns_guesstype "filename.png" } -match "glob" -result "image/png*" test ns_guesstype-6.87 {basic operation: ns_guesstype with extension .pot} -body { ns_guesstype "filename.pot" } -match "glob" -result "application/vnd.ms-powerpoint*" test ns_guesstype-6.88 {basic operation: ns_guesstype with extension .pps} -body { ns_guesstype "filename.pps" } -match "glob" -result "application/vnd.ms-powerpoint*" test ns_guesstype-6.89 {basic operation: ns_guesstype with extension .ppt} -body { ns_guesstype "filename.ppt" } -match "glob" -result "application/vnd.ms-powerpoint*" test ns_guesstype-6.90 {basic operation: ns_guesstype with extension .ps} -body { ns_guesstype "filename.ps" } -match "glob" -result "application/postscript*" test ns_guesstype-6.91 {basic operation: ns_guesstype with extension .pub} -body { ns_guesstype "filename.pub" } -match "glob" -result "application/x-mspubllisher*" test ns_guesstype-6.92 {basic operation: ns_guesstype with extension .qt} -body { ns_guesstype "filename.qt" } -match "glob" -result "video/quicktime*" test ns_guesstype-6.93 {basic operation: ns_guesstype with extension .ra} -body { ns_guesstype "filename.ra" } -match "glob" -result "audio/x-pn-realaudio*" test ns_guesstype-6.94 {basic operation: ns_guesstype with extension .ram} -body { ns_guesstype "filename.ram" } -match "glob" -result "audio/x-pn-realaudio*" test ns_guesstype-6.95 {basic operation: ns_guesstype with extension .ras} -body { ns_guesstype "filename.ras" } -match "glob" -result "image/x-cmu-raster*" test ns_guesstype-6.96 {basic operation: ns_guesstype with extension .rdf} -body { ns_guesstype "filename.rdf" } -match "glob" -result "application/rdf+xml*" test ns_guesstype-6.97 {basic operation: ns_guesstype with extension .rgb} -body { ns_guesstype "filename.rgb" } -match "glob" -result "image/x-rgb*" test ns_guesstype-6.98 {basic operation: ns_guesstype with extension .rtf} -body { ns_guesstype "filename.rtf" } -match "glob" -result "text/rtf*" test ns_guesstype-6.99 {basic operation: ns_guesstype with extension .rtx} -body { ns_guesstype "filename.rtx" } -match "glob" -result "text/richtext*" test ns_guesstype-6.100 {basic operation: ns_guesstype with extension .rss} -body { ns_guesstype "filename.rss" } -match "glob" -result "application/rss+xml*" test ns_guesstype-6.101 {basic operation: ns_guesstype with extension .sit} -body { ns_guesstype "filename.sit" } -match "glob" -result "application/x-stuffit*" test ns_guesstype-6.102 {basic operation: ns_guesstype with extension .smi} -body { ns_guesstype "filename.smi" } -match "glob" -result "application/smil*" test ns_guesstype-6.103 {basic operation: ns_guesstype with extension .smil} -body { ns_guesstype "filename.smil" } -match "glob" -result "application/smil*" test ns_guesstype-6.104 {basic operation: ns_guesstype with extension .snd} -body { ns_guesstype "filename.snd" } -match "glob" -result "audio/basic*" test ns_guesstype-6.105 {basic operation: ns_guesstype with extension .spx} -body { ns_guesstype "filename.spx" } -match "glob" -result "application/ogg*" test ns_guesstype-6.106 {basic operation: ns_guesstype with extension .sql} -body { ns_guesstype "filename.sql" } -match "glob" -result "application/x-sql*" test ns_guesstype-6.107 {basic operation: ns_guesstype with extension .stc} -body { ns_guesstype "filename.stc" } -match "glob" -result "application/vnd.sun.xml.calc.template*" cleanupTests --- NEW FILE: ns_httptime.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_httptime.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv if {[ns_httptime 0] eq "Thu, 01 Jan 1970 00:00:00 GMT"} { testConstraint correctLocale true } test ns_httptime-1.1 {basic syntax: plain call} -body { ns_httptime } -constraints correctLocale -returnCodes error -result {wrong # args: should be "ns_httptime time"} test ns_httptime-1.2 {basic syntax: wrong arg type} -body { ns_httptime a } -constraints correctLocale -returnCodes error -result {expected integer but got "a"} test ns_httptime-1.3 {basic syntax: wrong number of args} -body { ns_httptime 1 2 } -constraints correctLocale -returnCodes error -result {wrong # args: should be "ns_httptime time"} test ns_httptime-2.1 {basic operation} -body { ns_httptime 0 } -constraints correctLocale -result {Thu, 01 Jan 1970 00:00:00 GMT} test ns_httptime-2.2 {basic operation} -body { ns_httptime 1 } -constraints correctLocale -result {Thu, 01 Jan 1970 00:00:01 GMT} test ns_httptime-2.3 {basic operation} -body { ns_httptime -1 } -constraints correctLocale -result {Wed, 31 Dec 1969 23:59:59 GMT} test ns_httptime-2.4 {basic operation} -body { ns_httptime 1129794520 } -constraints correctLocale -result {Thu, 20 Oct 2005 07:48:40 GMT} cleanupTests --- NEW FILE: ns_gifsize.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_gifsize.test,v 1.1 2005/10/20 17:02:45 eide Exp $ # # Thanks to Michael P. Lex (Kinetiqa) # package require tcltest 2.2 namespace import -force ::tcltest::* set home [ns_config test home] if {[file exists "${home}/images/empty.gif"] && [file readable "${home}/images/empty.gif"]} { testConstraint fileExistsEmpty true } if {[file exists "${home}/images/broken.gif"] && [file readable "${home}/images/broken.gif"]} { testConstraint fileExistsBroken true } if {[file exists "${home}/images/color5x200.gif"] && [file readable "${home}/images/color5x200.gif"]} { testConstraint fileExistsIndexed true } if {[file exists "${home}/images/small.gif"] && [file readable "${home}/images/small.gif"]} { testConstraint fileExistsSmall true } test ns_gifsize-1.1 {syntax} -body { ns_gifsize } -returnCodes error -result {wrong # args: should be "ns_gifsize gif_file"} test ns_gifsize-2.1 {file does not exist} -body { ns_gifsize "${home}/images/noexist.gif" } -returnCodes error -match "glob" -result {couldn't open "*": no such file or directory} test ns_gifsize-2.2 {file is empty} -constraints fileExistsEmpty -body { ns_gifsize "${home}/images/empty.gif" } -returnCodes error -match "glob" -result {could not read "*": *} test ns_gifsize-2.3 {file is broken} -constraints fileExistsBroken -body { ns_gifsize "${home}/images/broken.gif" } -returnCodes error -match "glob" -result {bad gif file*} test ns_gifsize-2.4 {normal indexed gif} -constraints fileExistsIndexed -body { ns_gifsize "${home}/images/color5x200.gif" } -result [list 5 200] test ns_gifsize-2.5 {small gif} -constraints fileExistsSmall -body { ns_gifsize "${home}/images/small.gif" } -result [list 1 1] cleanupTests |