@@ -24,13 +24,21 @@ function emulator () {
24
24
type : 'file' ,
25
25
modified : Date . now ( ) ,
26
26
content : 'some err'
27
+ } ,
28
+ '/somedir' : {
29
+ type : 'dir' ,
30
+ modified : Date . now ( )
31
+ } ,
32
+ '/somedir/subdir' : {
33
+ type : 'dir' ,
34
+ modified : Date . now ( )
27
35
}
28
36
}
29
37
} )
30
38
}
31
39
32
40
test ( 'mv' , function ( t ) {
33
- t . plan ( 28 )
41
+ t . plan ( 33 )
34
42
35
43
emulator ( ) . run ( 'mv' ) . then ( null , function ( output ) {
36
44
t . equal ( output , 'mv: missing file operand' , 'fail without args' )
@@ -157,4 +165,28 @@ test('mv', function (t) {
157
165
} ) . then ( function ( output ) {
158
166
t . equal ( output , 'read this first' , 'create new file' )
159
167
} )
168
+
169
+ var mul8 = emulator ( )
170
+ mul8 . run ( 'mv somedir othername' )
171
+ . then ( function ( output ) {
172
+ t . equal ( output , '' , 'no output on success' )
173
+ return mul8 . stat ( 'somedir' )
174
+ } )
175
+ . then ( null , function ( ) {
176
+ t . ok ( true , 'old directory is gone' )
177
+ return mul8 . stat ( 'somedir/subdir' )
178
+ } )
179
+ . then ( null , function ( ) {
180
+ t . ok ( true , 'old sub-directory is gone' )
181
+ return mul8 . stat ( 'othername' )
182
+ } )
183
+ . then ( function ( ) {
184
+ t . ok ( true , 'directory is at new location' )
185
+ return mul8 . stat ( 'othername/subdir' )
186
+ } , function ( ) {
187
+ console . log ( arguments )
188
+ } )
189
+ . then ( function ( ) {
190
+ t . ok ( true , 'sub-directory has been moved too' )
191
+ } )
160
192
} )
0 commit comments