blob: 99df73f92268a8e0383acbf3cc7de60171147010 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# file : tests/builtin/mv.testscript
# license : MIT; see accompanying LICENSE file
test.arguments = "mv"
test.options += -c
: unknown-option
:
$* -u >'option -u' 2>"mv: unknown option '-u'" == 1
: args
:
{
: none
:
$* 2>"mv: missing arguments" == 1
: no-source
:
$* a 2>"mv: missing source path" == 1
: no-trailing-sep
:
$* a b c 2>"mv: multiple source paths without trailing separator for destination directory" == 1
: empty
:
{
: dest
:
$* '' 2>"mv: invalid path ''" == 1
: src1
:
$* '' a 2>"mv: invalid path ''" == 1
: src2
:
$* '' a b/ 2>"mv: invalid path ''" == 1
}
}
: synopsis-1
:
: Move an entity to the specified path.
:
{
: file
:
{
: existing
:
{
: to-non-existing
:
{
touch a &!a;
$* a b >>/~%EOO% &b;
%move .+/a .+/b false true%
%move .+/a .+/b false false%
EOO
test -f b && test -f a == 1
}
: to-existing
:
{
touch a b &!a;
$* a b >>/~%EOO%;
%move .+/a .+/b false true%
%move .+/a .+/b false false%
EOO
test -f b && test -f a == 1
}
: to-self
:
{
touch a;
$* a a >/~'%move .+/a .+/a false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to itself%
EOE
}
: to-dir
:
{
touch a;
mkdir b;
$* a b >/~'%move .+/a .+/b false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to '.+/b': .+%
EOE
}
}
}
: dir
:
{
: existing
:
{
: to-non-existing
:
{
mkdir a &!a/;
$* a b &b/ >>/~%EOO%;
%move .+/a .+/b false true%
%move .+/a .+/b false false%
EOO
test -d b && test -d a == 1
}
: to-non-empty
:
{
mkdir a b;
touch b/c;
$* a b >/~'%move .+/a .+/b false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to '.+/b': .+%
EOE
}
: to-non-dir
:
{
mkdir a;
touch b;
$* a b >/~'%move .+/a .+/b false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to '.+/b': .+%
EOE
}
}
: overlap
:
{
mkdir a;
$* a a/b >/~'%move .+/a .+/a/b false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to '.+/a/b': .+%
EOE
}
}
: non-existing
:
{
$* a b >/~'%move .+/a .+/b false true%' 2>>/~%EOE% != 0
%mv: unable to move entry '.+/a' to '.+/b': .+%
EOE
}
}
: synopsis-2
:
: Move entities into the specified directory.
:
{
mkdir a c &!a/;
touch a/b b &!a/b &!b;
$* a b c/ >>/~%EOO% &c/a/ &c/a/b &c/b;
%move .+/a .+/c/a false true%
%move .+/a .+/c/a false false%
%move .+/b .+/c/b false true%
%move .+/b .+/c/b false false%
EOO
test -d c/a && test -f c/a/b && test -f c/b
}
|