From cbd3fd20bd2ade1a59cde97cfa4e2b112f88445a Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 17 May 2019 08:09:29 +0000 Subject: Add test for what happens when the directory in the template doesn't exist; doc it too. --- doc/file.n | 13 +++++++------ tests/cmdAH.test | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/file.n b/doc/file.n index 0929204..554da39 100644 --- a/doc/file.n +++ b/doc/file.n @@ -438,12 +438,13 @@ return \fBb\fR. .VS "8.7, TIP 431" Creates a temporary directory (guaranteed to be newly created and writable by the current script) and returns its name. If \fItemplate\fR is given, it -specifies one of or both of the directory to contain the temporary directory, -and the base part of the directory name; it is considered to have the location -of the directory if there is a directory separator in the name, and the base -part is everything after the last directory separator (if non-empty). -The default containing directory is determined by system-specific operations, -and the default base name prefix is +specifies one of or both of the existing directory (on a filesystem controlled +by the operating system) to contain the temporary directory, and the base part +of the directory name; it is considered to have the location of the directory +if there is a directory separator in the name, and the base part is everything +after the last directory separator (if non-empty). The default containing +directory is determined by system-specific operations, and the default base +name prefix is .QW \fBtcl\fR . .RS .PP diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 789e77a..f8ab361 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -1698,6 +1698,22 @@ test cmdAH-33.5 {file tempdir} -setup { } -match glob -result {GORP:/gorp_* 1 directory {} {}} -cleanup { catch {file delete -force $base} } +test cmdAH-33.6 {file tempdir: missing parent dir} -setup { + set base [file join [temporaryDirectory] gorp] + file mkdir $base +} -returnCodes error -body { + file tempdir $base/quux/ +} -cleanup { + catch {file delete -force $base} +} -result {can't create temporary directory: no such file or directory} +test cmdAH-33.7 {file tempdir: missing parent dir} -setup { + set base [file join [temporaryDirectory] gorp] + file mkdir $base +} -returnCodes error -body { + file tempdir $base/quux/foobar +} -cleanup { + catch {file delete -force $base} +} -result {can't create temporary directory: no such file or directory} # This shouldn't work, but just in case a test above failed... catch {close $newFileId} -- cgit v0.12