Mercurial > hg > toybox
annotate scripts/test/rmdir.test @ 291:620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 04 May 2008 19:44:39 -0500 |
parents | d37e2de3a9f3 |
children | 3d7526f6115b |
rev | line source |
---|---|
290 | 1 #!/bin/bash |
2 | |
3 [ -f testing.sh ] && . testing.sh | |
4 | |
5 #testing "name" "command" "result" "infile" "stdin" | |
6 | |
7 mkdir one | |
291
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
8 testing "rmdir" "rmdir one && [ ! -d one ] && echo yes" "yes\n" "" "" |
290 | 9 |
10 touch walrus | |
11 testing "rmdir file" \ | |
12 "rmdir walrus 2> /dev/null || [ -f walrus ] && echo yes" "yes\n" "" "" | |
13 | |
14 mkdir one two | |
15 testing "rmdir one two" \ | |
16 "rmdir one two 2> /dev/null && [ ! -d one ] && [ ! -d two ] && echo yes" \ | |
17 "yes\n" "" "" | |
18 | |
19 mkdir one two three | |
20 testing "rmdir one missing two file three" \ | |
21 "rmdir one missing two walrus three 2> /dev/null || [ ! -d three ] && echo yes" \ | |
22 "yes\n" "" "" | |
291
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
23 rm walrus |
290 | 24 |
25 mkdir one | |
26 chmod 000 one | |
27 testing "rmdir mode 000" "rmdir one && [ ! -d one ] && echo yes" "yes\n" "" "" | |
28 | |
29 mkdir temp | |
30 touch temp/thing | |
31 testing "rmdir non-empty" \ | |
32 "rmdir temp 2>/dev/null || [ -d temp ] && echo yes" "yes\n" "" "" | |
33 testing "rmdir -p dir/file" \ | |
34 "rmdir -p temp/thing 2>/dev/null || [ -f temp/thing ] && echo yes" \ | |
35 "yes\n" "" "" | |
36 | |
37 mkdir -p temp/one/two/three | |
38 testing "rmdir -p part of path" \ | |
39 "rmdir -p temp/one/two/three 2>/dev/null || [ -d temp ] && [ ! -e temp/one ] && echo yes" \ | |
40 "yes\n" "" "" | |
41 rm -rf temp | |
42 | |
291
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
43 |
290 | 44 mkdir -p one/two/three |
45 testing "rmdir -p one/two/three" \ | |
46 "rmdir -p one/two/three && [ ! -e one ] && echo yes" "yes\n" "" "" | |
291
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
47 |
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
48 #mkdir -p one/two/three |
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
49 #chmod 000 one/two/three one/two one |
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
50 #testing "rmdir -p one/two/three" \ |
620a2eab6b82
More tweaks to rmdir.test and the testing infrastructure.
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
51 # "rmdir -p one/two/three && [ ! -e one ] && echo yes" "yes\n" "" "" |