From cb949bdfb80b4023e73d82676c9d7a50e1829c26 Mon Sep 17 00:00:00 2001 From: Vince Darley Date: Thu, 25 Apr 2002 10:36:55 +0000 Subject: [PATCH] better tests --- tests/vfsUrl.test | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/vfsUrl.test b/tests/vfsUrl.test index cb32d75..3001c54 100644 --- a/tests/vfsUrl.test +++ b/tests/vfsUrl.test @@ -24,6 +24,19 @@ if {![auto_load ::vfs::urltype::Mount]} { puts stdout "These tests require an internet connection, and might" puts stdout "take a long time to complete." +set vfsTestDir [pwd] +if {![file writable $vfsTestDir]} { + if {[info exists env(TEMP)] && [file writable $env(TEMP)]} { + set vfsTestDir $env(TEMP) + tcltest::testConstraint vfsWritable 1 + puts stdout "Using temporary directory for some files" + } else { + tcltest::testConstraint vfsWritable 0 + } +} else { + tcltest::testConstraint vfsWritable 1 +} + test vfsUrl-1.1 {mount} { vfs::urltype::Mount ftp } {Mounted at "ftp://"} @@ -44,8 +57,8 @@ test vfsUrl-1.3 {mounted volumes} { test vfsUrl-2.1 {auto-mount ftp and copy file} { file delete -force README.tclversions - file copy ftp://ftp.scriptics.com/pub/tcl/README.tclversions . - set to README.tclversions + file copy ftp://ftp.scriptics.com/pub/tcl/README.tclversions $vfsTestDir + set to [file join $vfsTestDir README.tclversions] if {[file exists $to]} { if {[file size $to] < 800} { set res "file too short" @@ -60,8 +73,8 @@ test vfsUrl-2.1 {auto-mount ftp and copy file} { } {ok} test vfsUrl-2.2 {auto-mount bad ftp} { - catch {file copy ftp://ftp.scriptxxics.com/pub/tcl/README.tclversions .} - set to README.tclversions + catch {file copy ftp://ftp.scriptxxics.com/pub/tcl/README.tclversions $vfsTestDir} + set to [file join $vfsTestDir README.tclversions] if {[file exists $to]} { set res "file shouldn't exist!" file delete -force $to -- 2.23.0