regsub: fix substitution with a trailing backslash
[jimtcl.git] / tests / filedir.test
blob4dd78cafdf50c437ee134813413b9af4ac436db6
1 source [file dirname [info script]]/testing.tcl
3 needs cmd file
4 needs cmd exec
6 catch {
7         exec rm -rf tmp
8         exec mkdir tmp
9         exec touch tmp/file
10         exec mkdir tmp/dir
13 test mkdir-1.1 "Simple dir" {
14         file mkdir tmp/abc
15         file isdir tmp/abc
16 } {1}
18 test mkdir-1.2 "Create missing parents" {
19         file mkdir tmp/def/ghi/jkl
20         file isdir tmp/def/ghi/jkl
21 } {1}
23 test mkdir-1.3 "Existing dir" {
24         file mkdir tmp/dir
25         file isdir tmp/dir
26 } {1}
28 test mkdir-1.4 "Child of existing dir" {
29         file mkdir tmp/dir/child
30         file isdir tmp/dir/child
31 } {1}
33 test mkdir-1.5 "Create dir over existing file" {
34         list [catch {file mkdir tmp/file} msg] [file isdir tmp/file]
35 } {1 0}
37 test mkdir-1.6 "Create dir below existing file" {
38         list [catch {file mkdir tmp/file/dir} msg] [file isdir tmp/file/dir]
39 } {1 0}
41 test mkdir-1.8 "Multiple dirs" {
42         file mkdir tmp/1 tmp/2 tmp/3
43         list [file isdir tmp/1] [file isdir tmp/2] [file isdir tmp/3]
44 } {1 1 1}
46 test mkdir-1.7 "Stop on failure" {
47         catch {file mkdir tmp/4 tmp/file tmp/5}
48         list [file isdir tmp/4] [file isdir tmp/5]
49 } {1 0}
51 test rmdir-2.0 "Remove existing dir" {
52         file delete tmp/1
53         file isdir tmp/1
54 } {0}
56 test rmdir-2.1 "Remove missing dir" {
57         file delete tmp/1
58 } {}
60 test rmdir-2.2 "Remove non-empty dir" {
61         catch {file delete tmp/def}
62 } {1}
64 catch {
65         exec rm -rf tmp
68 testreport