Tcl Source Code

Check-in [92fce1400e]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test for what happens when the directory in the template doesn't exist; doc it too.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-431
Files: files | file ages | folders
SHA3-256:92fce1400efbbb17e7e2bd9ca3ab8c3dc31576fbd8017fa8f1ca7a68fc9adf3f
User & Date: dkf 2019-05-17 08:09:29
Context
2019-05-17
08:13
Remove misleading comment in nroff source Leaf check-in: b1549abd3f user: dkf tags: tip-431
08:09
Add test for what happens when the directory in the template doesn't exist; doc it too. check-in: 92fce1400e user: dkf tags: tip-431
07:31
merge core-8-branch check-in: 8cdb898408 user: dkf tags: tip-431
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/file.n.

434
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449
450
451
452
453
return \fBb\fR.
.TP
\fBfile tempdir\fR ?\fItemplate\fR?
'\" TIP #210
.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
.QW \fBtcl\fR .
.RS
.PP
The following output is typical and illustrative; the actual output will vary
between platforms:
.PP
.CS







|
>
|
|
|
|
|







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
return \fBb\fR.
.TP
\fBfile tempdir\fR ?\fItemplate\fR?
'\" TIP #210
.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 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
The following output is typical and illustrative; the actual output will vary
between platforms:
.PP
.CS

Changes to tests/cmdAH.test.

1694
1695
1696
1697
1698
1699
1700
















1701
1702
1703
1704
1705
1706
1707
    set pre [glob -nocomplain -directory $base *]
    set d [file normalize [file tempdir $base/gorp]]
    list [string map [list $base GORP:] $d] [file exists $d] [file type $d] \
	$pre [glob -nocomplain -directory $d *]
} -match glob -result {GORP:/gorp_* 1 directory {} {}} -cleanup {
    catch {file delete -force $base}
}
















 
# This shouldn't work, but just in case a test above failed...
catch {close $newFileId}

interp delete safeInterp
interp delete simpleInterp








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
    set pre [glob -nocomplain -directory $base *]
    set d [file normalize [file tempdir $base/gorp]]
    list [string map [list $base GORP:] $d] [file exists $d] [file type $d] \
	$pre [glob -nocomplain -directory $d *]
} -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}

interp delete safeInterp
interp delete simpleInterp