Fossil SCM
Add and refine tests, part 2.
Commit
0b5b87ac84c8701cab65b87dfec7c743bbc812cd
Parent
d2cf0713ef8ee45…
1 file changed
+222
-36
+222
-36
| --- test/mv-rm.test | ||
| +++ test/mv-rm.test | ||
| @@ -44,11 +44,21 @@ | ||
| 44 | 44 | write_file f5 "f5" |
| 45 | 45 | write_file f6 "f6" |
| 46 | 46 | write_file f7 "f7" |
| 47 | 47 | write_file f8 "f8" |
| 48 | 48 | |
| 49 | -fossil add f1 f2 f3 f4 f5 f6 f7 f8 | |
| 49 | +file mkdir [file join $rootDir subdirA] | |
| 50 | +# NOTE: There are no files in subdirA. | |
| 51 | + | |
| 52 | +file mkdir [file join $rootDir subdirB] | |
| 53 | +write_file [file join $rootDir subdirB f9] "f9" | |
| 54 | + | |
| 55 | +file mkdir [file join $rootDir subdirC] | |
| 56 | +write_file [file join $rootDir subdirC f10] "f10" | |
| 57 | +write_file [file join $rootDir subdirC f11] "f11" | |
| 58 | + | |
| 59 | +fossil add f1 f2 f3 f4 f5 f6 f7 f8 subdirB/f9 subdirC/f10 subdirC/f11 | |
| 50 | 60 | fossil commit -m "c1" |
| 51 | 61 | |
| 52 | 62 | ######################################## |
| 53 | 63 | # Test 1: Soft Move Relative Directory # |
| 54 | 64 | ######################################## |
| @@ -59,30 +69,28 @@ | ||
| 59 | 69 | fossil mv ../f1 . |
| 60 | 70 | test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"} |
| 61 | 71 | |
| 62 | 72 | fossil revert |
| 63 | 73 | test mv-soft-relative-2 { |
| 64 | - [normalize_result] eq \ | |
| 65 | - "DELETE: subdir1/f1\nREVERTED: f1${undoMsg}" | |
| 74 | + [normalize_result] eq "DELETE: subdir1/f1\nREVERTED: f1${undoMsg}" | |
| 66 | 75 | } |
| 67 | 76 | |
| 68 | 77 | cd $rootDir |
| 69 | 78 | |
| 70 | -######################################## | |
| 71 | -# Test 2: Soft Move Relative File # | |
| 72 | -######################################## | |
| 79 | +################################### | |
| 80 | +# Test 2: Soft Move Relative File # | |
| 81 | +################################### | |
| 73 | 82 | |
| 74 | 83 | file mkdir [file join $rootDir subdir2] |
| 75 | 84 | cd [file join $rootDir subdir2] |
| 76 | 85 | |
| 77 | 86 | fossil mv ../f2 ./f2 |
| 78 | 87 | test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"} |
| 79 | 88 | |
| 80 | 89 | fossil revert |
| 81 | 90 | test mv-soft-relative-4 { |
| 82 | - [normalize_result] eq \ | |
| 83 | - "DELETE: subdir2/f2\nREVERTED: f2${undoMsg}" | |
| 91 | + [normalize_result] eq "DELETE: subdir2/f2\nREVERTED: f2${undoMsg}" | |
| 84 | 92 | } |
| 85 | 93 | |
| 86 | 94 | cd $rootDir |
| 87 | 95 | |
| 88 | 96 | ######################################## |
| @@ -92,39 +100,35 @@ | ||
| 92 | 100 | file mkdir [file join $rootDir subdir3] |
| 93 | 101 | cd [file join $rootDir subdir3] |
| 94 | 102 | |
| 95 | 103 | fossil mv --hard ../f3 . |
| 96 | 104 | test mv-hard-relative-1 { |
| 97 | - [normalize_result] eq \ | |
| 98 | - "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3" | |
| 105 | + [normalize_result] eq "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3" | |
| 99 | 106 | } |
| 100 | 107 | |
| 101 | 108 | fossil revert |
| 102 | 109 | test mv-hard-relative-2 { |
| 103 | - [normalize_result] eq \ | |
| 104 | - "DELETE: subdir3/f3\nREVERTED: f3${undoMsg}" | |
| 110 | + [normalize_result] eq "DELETE: subdir3/f3\nREVERTED: f3${undoMsg}" | |
| 105 | 111 | } |
| 106 | 112 | |
| 107 | 113 | cd $rootDir |
| 108 | 114 | |
| 109 | -######################################## | |
| 110 | -# Test 4: Hard Move Relative File # | |
| 111 | -######################################## | |
| 115 | +################################### | |
| 116 | +# Test 4: Hard Move Relative File # | |
| 117 | +################################### | |
| 112 | 118 | |
| 113 | 119 | file mkdir [file join $rootDir subdir4] |
| 114 | 120 | cd [file join $rootDir subdir4] |
| 115 | 121 | |
| 116 | 122 | fossil mv --hard ../f4 ./f4 |
| 117 | 123 | test mv-hard-relative-3 { |
| 118 | - [normalize_result] eq \ | |
| 119 | - "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4" | |
| 124 | + [normalize_result] eq "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4" | |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | 127 | fossil revert |
| 123 | 128 | test mv-hard-relative-4 { |
| 124 | - [normalize_result] eq \ | |
| 125 | - "DELETE: subdir4/f4\nREVERTED: f4${undoMsg}" | |
| 129 | + [normalize_result] eq "DELETE: subdir4/f4\nREVERTED: f4${undoMsg}" | |
| 126 | 130 | } |
| 127 | 131 | |
| 128 | 132 | cd $rootDir |
| 129 | 133 | |
| 130 | 134 | ######################################## |
| @@ -137,30 +141,28 @@ | ||
| 137 | 141 | fossil mv [file join $rootDir f5] [file join $rootDir subdir5] |
| 138 | 142 | test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"} |
| 139 | 143 | |
| 140 | 144 | fossil revert |
| 141 | 145 | test mv-soft-absolute-2 { |
| 142 | - [normalize_result] eq \ | |
| 143 | - "DELETE: subdir5/f5\nREVERTED: f5${undoMsg}" | |
| 146 | + [normalize_result] eq "DELETE: subdir5/f5\nREVERTED: f5${undoMsg}" | |
| 144 | 147 | } |
| 145 | 148 | |
| 146 | 149 | cd $rootDir |
| 147 | 150 | |
| 148 | -######################################## | |
| 149 | -# Test 6: Soft Move Absolute File # | |
| 150 | -######################################## | |
| 151 | +################################### | |
| 152 | +# Test 6: Soft Move Absolute File # | |
| 153 | +################################### | |
| 151 | 154 | |
| 152 | 155 | file mkdir [file join $rootDir subdir6] |
| 153 | 156 | cd [file join $rootDir subdir6] |
| 154 | 157 | |
| 155 | 158 | fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6] |
| 156 | 159 | test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"} |
| 157 | 160 | |
| 158 | 161 | fossil revert |
| 159 | 162 | test mv-soft-absolute-4 { |
| 160 | - [normalize_result] eq \ | |
| 161 | - "DELETE: subdir6/f6\nREVERTED: f6${undoMsg}" | |
| 163 | + [normalize_result] eq "DELETE: subdir6/f6\nREVERTED: f6${undoMsg}" | |
| 162 | 164 | } |
| 163 | 165 | |
| 164 | 166 | cd $rootDir |
| 165 | 167 | |
| 166 | 168 | ######################################## |
| @@ -170,37 +172,221 @@ | ||
| 170 | 172 | file mkdir [file join $rootDir subdir7] |
| 171 | 173 | cd [file join $rootDir subdir7] |
| 172 | 174 | |
| 173 | 175 | fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7] |
| 174 | 176 | test mv-hard-absolute-1 { |
| 175 | - [normalize_result] eq \ | |
| 176 | - "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7" | |
| 177 | + [normalize_result] eq "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7" | |
| 177 | 178 | } |
| 178 | 179 | |
| 179 | 180 | fossil revert |
| 180 | 181 | test mv-hard-absolute-2 { |
| 181 | - [normalize_result] eq \ | |
| 182 | - "DELETE: subdir7/f7\nREVERTED: f7${undoMsg}" | |
| 182 | + [normalize_result] eq "DELETE: subdir7/f7\nREVERTED: f7${undoMsg}" | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | cd $rootDir |
| 186 | 186 | |
| 187 | -######################################## | |
| 188 | -# Test 8: Hard Move Absolute File # | |
| 189 | -######################################## | |
| 187 | +################################### | |
| 188 | +# Test 8: Hard Move Absolute File # | |
| 189 | +################################### | |
| 190 | 190 | |
| 191 | 191 | file mkdir [file join $rootDir subdir8] |
| 192 | 192 | cd [file join $rootDir subdir8] |
| 193 | 193 | |
| 194 | 194 | fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8] |
| 195 | 195 | test mv-hard-absolute-3 { |
| 196 | - [normalize_result] eq \ | |
| 197 | - "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8" | |
| 196 | + [normalize_result] eq "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8" | |
| 198 | 197 | } |
| 199 | 198 | |
| 200 | 199 | fossil revert |
| 201 | 200 | test mv-hard-absolute-4 { |
| 201 | + [normalize_result] eq "DELETE: subdir8/f8\nREVERTED: f8${undoMsg}" | |
| 202 | +} | |
| 203 | + | |
| 204 | +cd $rootDir | |
| 205 | + | |
| 206 | +########################################## | |
| 207 | +# Test 9: Soft Remove Relative Directory # | |
| 208 | +########################################## | |
| 209 | + | |
| 210 | +file mkdir [file join $rootDir subdir1] | |
| 211 | +cd [file join $rootDir subdir1] | |
| 212 | + | |
| 213 | +fossil rm ../subdirA | |
| 214 | +test rm-soft-relative-1 {$RESULT eq ""} | |
| 215 | + | |
| 216 | +fossil rm ../subdirB | |
| 217 | +test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"} | |
| 218 | + | |
| 219 | +fossil rm ../subdirC | |
| 220 | +test rm-soft-relative-3 { | |
| 221 | + [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11" | |
| 222 | +} | |
| 223 | + | |
| 224 | +fossil revert | |
| 225 | +test rm-soft-relative-4 { | |
| 226 | + [normalize_result] eq \ | |
| 227 | + "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" | |
| 228 | +} | |
| 229 | + | |
| 230 | +cd $rootDir | |
| 231 | + | |
| 232 | +###################################### | |
| 233 | +# Test 10: Soft Remove Relative File # | |
| 234 | +###################################### | |
| 235 | + | |
| 236 | +file mkdir [file join $rootDir subdir2] | |
| 237 | +cd [file join $rootDir subdir2] | |
| 238 | + | |
| 239 | +fossil rm ../f2 | |
| 240 | +test rm-soft-relative-5 {$RESULT eq "DELETED f2"} | |
| 241 | + | |
| 242 | +fossil revert | |
| 243 | +test rm-soft-relative-6 { | |
| 244 | + [normalize_result] eq "REVERTED: f2${undoMsg}" | |
| 245 | +} | |
| 246 | + | |
| 247 | +cd $rootDir | |
| 248 | + | |
| 249 | +########################################### | |
| 250 | +# Test 11: Hard Remove Relative Directory # | |
| 251 | +########################################### | |
| 252 | + | |
| 253 | +file mkdir [file join $rootDir subdir3] | |
| 254 | +cd [file join $rootDir subdir3] | |
| 255 | + | |
| 256 | +fossil rm --hard ../subdirA | |
| 257 | +test rm-hard-relative-1 { | |
| 258 | + [normalize_result] eq "" | |
| 259 | +} | |
| 260 | + | |
| 261 | +fossil rm --hard ../subdirB | |
| 262 | +test rm-hard-relative-2 { | |
| 263 | + [normalize_result] eq \ | |
| 264 | + "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9" | |
| 265 | +} | |
| 266 | + | |
| 267 | +fossil rm --hard ../subdirC | |
| 268 | +test rm-hard-relative-3 { | |
| 269 | + [normalize_result] eq \ | |
| 270 | + "DELETED subdirC/f10\nDELETED subdirC/f11\nDELETED_FILE\ | |
| 271 | +${rootDir}/subdirC/f10\nDELETED_FILE ${rootDir}/subdirC/f11" | |
| 272 | +} | |
| 273 | + | |
| 274 | +fossil revert | |
| 275 | +test rm-hard-relative-4 { | |
| 276 | + [normalize_result] eq \ | |
| 277 | + "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" | |
| 278 | +} | |
| 279 | + | |
| 280 | +cd $rootDir | |
| 281 | + | |
| 282 | +###################################### | |
| 283 | +# Test 12: Hard Remove Relative File # | |
| 284 | +###################################### | |
| 285 | + | |
| 286 | +file mkdir [file join $rootDir subdir4] | |
| 287 | +cd [file join $rootDir subdir4] | |
| 288 | + | |
| 289 | +fossil rm --hard ../f4 | |
| 290 | +test rm-hard-relative-5 { | |
| 291 | + [normalize_result] eq "DELETED f4\nDELETED_FILE ${rootDir}/f4" | |
| 292 | +} | |
| 293 | + | |
| 294 | +fossil revert | |
| 295 | +test rm-hard-relative-6 { | |
| 296 | + [normalize_result] eq "REVERTED: f4${undoMsg}" | |
| 297 | +} | |
| 298 | + | |
| 299 | +cd $rootDir | |
| 300 | + | |
| 301 | +########################################### | |
| 302 | +# Test 13: Soft Remove Absolute Directory # | |
| 303 | +########################################### | |
| 304 | + | |
| 305 | +file mkdir [file join $rootDir subdir5] | |
| 306 | +cd [file join $rootDir subdir5] | |
| 307 | + | |
| 308 | +fossil rm [file join $rootDir subdirA] | |
| 309 | +test rm-soft-absolute-1 {$RESULT eq ""} | |
| 310 | + | |
| 311 | +fossil rm [file join $rootDir subdirB] | |
| 312 | +test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"} | |
| 313 | + | |
| 314 | +fossil rm [file join $rootDir subdirC] | |
| 315 | +test rm-soft-absolute-3 { | |
| 316 | + [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11" | |
| 317 | +} | |
| 318 | + | |
| 319 | +fossil revert | |
| 320 | +test rm-soft-absolute-4 { | |
| 321 | + [normalize_result] eq \ | |
| 322 | + "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" | |
| 323 | +} | |
| 324 | + | |
| 325 | +cd $rootDir | |
| 326 | + | |
| 327 | +###################################### | |
| 328 | +# Test 14: Soft Remove Absolute File # | |
| 329 | +###################################### | |
| 330 | + | |
| 331 | +file mkdir [file join $rootDir subdir6] | |
| 332 | +cd [file join $rootDir subdir6] | |
| 333 | + | |
| 334 | +fossil rm [file join $rootDir f6] | |
| 335 | +test rm-soft-absolute-5 {$RESULT eq "DELETED f6"} | |
| 336 | + | |
| 337 | +fossil revert | |
| 338 | +test rm-soft-absolute-6 { | |
| 339 | + [normalize_result] eq "REVERTED: f6${undoMsg}" | |
| 340 | +} | |
| 341 | + | |
| 342 | +cd $rootDir | |
| 343 | + | |
| 344 | +########################################### | |
| 345 | +# Test 15: Hard Remove Absolute Directory # | |
| 346 | +########################################### | |
| 347 | + | |
| 348 | +file mkdir [file join $rootDir subdir7] | |
| 349 | +cd [file join $rootDir subdir7] | |
| 350 | + | |
| 351 | +fossil rm --hard [file join $rootDir subdirA] | |
| 352 | +test rm-hard-absolute-1 {$RESULT eq ""} | |
| 353 | + | |
| 354 | +fossil rm --hard [file join $rootDir subdirB] | |
| 355 | +test rm-hard-absolute-2 { | |
| 356 | + [normalize_result] eq \ | |
| 357 | + "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9" | |
| 358 | +} | |
| 359 | + | |
| 360 | +fossil rm --hard [file join $rootDir subdirC] | |
| 361 | +test rm-hard-absolute-3 { | |
| 362 | + [normalize_result] eq \ | |
| 363 | + "DELETED subdirC/f10\nDELETED subdirC/f11\nDELETED_FILE\ | |
| 364 | +${rootDir}/subdirC/f10\nDELETED_FILE ${rootDir}/subdirC/f11" | |
| 365 | +} | |
| 366 | + | |
| 367 | +fossil revert | |
| 368 | +test rm-hard-absolute-4 { | |
| 202 | 369 | [normalize_result] eq \ |
| 203 | - "DELETE: subdir8/f8\nREVERTED: f8${undoMsg}" | |
| 370 | + "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" | |
| 371 | +} | |
| 372 | + | |
| 373 | +cd $rootDir | |
| 374 | + | |
| 375 | +###################################### | |
| 376 | +# Test 16: Hard Remove Absolute File # | |
| 377 | +###################################### | |
| 378 | + | |
| 379 | +file mkdir [file join $rootDir subdir8] | |
| 380 | +cd [file join $rootDir subdir8] | |
| 381 | + | |
| 382 | +fossil rm --hard [file join $rootDir f8] | |
| 383 | +test rm-hard-absolute-5 { | |
| 384 | + [normalize_result] eq "DELETED f8\nDELETED_FILE ${rootDir}/f8" | |
| 385 | +} | |
| 386 | + | |
| 387 | +fossil revert | |
| 388 | +test rm-hard-absolute-6 { | |
| 389 | + [normalize_result] eq "REVERTED: f8${undoMsg}" | |
| 204 | 390 | } |
| 205 | 391 | |
| 206 | 392 | cd $rootDir |
| 207 | 393 |
| --- test/mv-rm.test | |
| +++ test/mv-rm.test | |
| @@ -44,11 +44,21 @@ | |
| 44 | write_file f5 "f5" |
| 45 | write_file f6 "f6" |
| 46 | write_file f7 "f7" |
| 47 | write_file f8 "f8" |
| 48 | |
| 49 | fossil add f1 f2 f3 f4 f5 f6 f7 f8 |
| 50 | fossil commit -m "c1" |
| 51 | |
| 52 | ######################################## |
| 53 | # Test 1: Soft Move Relative Directory # |
| 54 | ######################################## |
| @@ -59,30 +69,28 @@ | |
| 59 | fossil mv ../f1 . |
| 60 | test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"} |
| 61 | |
| 62 | fossil revert |
| 63 | test mv-soft-relative-2 { |
| 64 | [normalize_result] eq \ |
| 65 | "DELETE: subdir1/f1\nREVERTED: f1${undoMsg}" |
| 66 | } |
| 67 | |
| 68 | cd $rootDir |
| 69 | |
| 70 | ######################################## |
| 71 | # Test 2: Soft Move Relative File # |
| 72 | ######################################## |
| 73 | |
| 74 | file mkdir [file join $rootDir subdir2] |
| 75 | cd [file join $rootDir subdir2] |
| 76 | |
| 77 | fossil mv ../f2 ./f2 |
| 78 | test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"} |
| 79 | |
| 80 | fossil revert |
| 81 | test mv-soft-relative-4 { |
| 82 | [normalize_result] eq \ |
| 83 | "DELETE: subdir2/f2\nREVERTED: f2${undoMsg}" |
| 84 | } |
| 85 | |
| 86 | cd $rootDir |
| 87 | |
| 88 | ######################################## |
| @@ -92,39 +100,35 @@ | |
| 92 | file mkdir [file join $rootDir subdir3] |
| 93 | cd [file join $rootDir subdir3] |
| 94 | |
| 95 | fossil mv --hard ../f3 . |
| 96 | test mv-hard-relative-1 { |
| 97 | [normalize_result] eq \ |
| 98 | "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3" |
| 99 | } |
| 100 | |
| 101 | fossil revert |
| 102 | test mv-hard-relative-2 { |
| 103 | [normalize_result] eq \ |
| 104 | "DELETE: subdir3/f3\nREVERTED: f3${undoMsg}" |
| 105 | } |
| 106 | |
| 107 | cd $rootDir |
| 108 | |
| 109 | ######################################## |
| 110 | # Test 4: Hard Move Relative File # |
| 111 | ######################################## |
| 112 | |
| 113 | file mkdir [file join $rootDir subdir4] |
| 114 | cd [file join $rootDir subdir4] |
| 115 | |
| 116 | fossil mv --hard ../f4 ./f4 |
| 117 | test mv-hard-relative-3 { |
| 118 | [normalize_result] eq \ |
| 119 | "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4" |
| 120 | } |
| 121 | |
| 122 | fossil revert |
| 123 | test mv-hard-relative-4 { |
| 124 | [normalize_result] eq \ |
| 125 | "DELETE: subdir4/f4\nREVERTED: f4${undoMsg}" |
| 126 | } |
| 127 | |
| 128 | cd $rootDir |
| 129 | |
| 130 | ######################################## |
| @@ -137,30 +141,28 @@ | |
| 137 | fossil mv [file join $rootDir f5] [file join $rootDir subdir5] |
| 138 | test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"} |
| 139 | |
| 140 | fossil revert |
| 141 | test mv-soft-absolute-2 { |
| 142 | [normalize_result] eq \ |
| 143 | "DELETE: subdir5/f5\nREVERTED: f5${undoMsg}" |
| 144 | } |
| 145 | |
| 146 | cd $rootDir |
| 147 | |
| 148 | ######################################## |
| 149 | # Test 6: Soft Move Absolute File # |
| 150 | ######################################## |
| 151 | |
| 152 | file mkdir [file join $rootDir subdir6] |
| 153 | cd [file join $rootDir subdir6] |
| 154 | |
| 155 | fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6] |
| 156 | test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"} |
| 157 | |
| 158 | fossil revert |
| 159 | test mv-soft-absolute-4 { |
| 160 | [normalize_result] eq \ |
| 161 | "DELETE: subdir6/f6\nREVERTED: f6${undoMsg}" |
| 162 | } |
| 163 | |
| 164 | cd $rootDir |
| 165 | |
| 166 | ######################################## |
| @@ -170,37 +172,221 @@ | |
| 170 | file mkdir [file join $rootDir subdir7] |
| 171 | cd [file join $rootDir subdir7] |
| 172 | |
| 173 | fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7] |
| 174 | test mv-hard-absolute-1 { |
| 175 | [normalize_result] eq \ |
| 176 | "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7" |
| 177 | } |
| 178 | |
| 179 | fossil revert |
| 180 | test mv-hard-absolute-2 { |
| 181 | [normalize_result] eq \ |
| 182 | "DELETE: subdir7/f7\nREVERTED: f7${undoMsg}" |
| 183 | } |
| 184 | |
| 185 | cd $rootDir |
| 186 | |
| 187 | ######################################## |
| 188 | # Test 8: Hard Move Absolute File # |
| 189 | ######################################## |
| 190 | |
| 191 | file mkdir [file join $rootDir subdir8] |
| 192 | cd [file join $rootDir subdir8] |
| 193 | |
| 194 | fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8] |
| 195 | test mv-hard-absolute-3 { |
| 196 | [normalize_result] eq \ |
| 197 | "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8" |
| 198 | } |
| 199 | |
| 200 | fossil revert |
| 201 | test mv-hard-absolute-4 { |
| 202 | [normalize_result] eq \ |
| 203 | "DELETE: subdir8/f8\nREVERTED: f8${undoMsg}" |
| 204 | } |
| 205 | |
| 206 | cd $rootDir |
| 207 |
| --- test/mv-rm.test | |
| +++ test/mv-rm.test | |
| @@ -44,11 +44,21 @@ | |
| 44 | write_file f5 "f5" |
| 45 | write_file f6 "f6" |
| 46 | write_file f7 "f7" |
| 47 | write_file f8 "f8" |
| 48 | |
| 49 | file mkdir [file join $rootDir subdirA] |
| 50 | # NOTE: There are no files in subdirA. |
| 51 | |
| 52 | file mkdir [file join $rootDir subdirB] |
| 53 | write_file [file join $rootDir subdirB f9] "f9" |
| 54 | |
| 55 | file mkdir [file join $rootDir subdirC] |
| 56 | write_file [file join $rootDir subdirC f10] "f10" |
| 57 | write_file [file join $rootDir subdirC f11] "f11" |
| 58 | |
| 59 | fossil add f1 f2 f3 f4 f5 f6 f7 f8 subdirB/f9 subdirC/f10 subdirC/f11 |
| 60 | fossil commit -m "c1" |
| 61 | |
| 62 | ######################################## |
| 63 | # Test 1: Soft Move Relative Directory # |
| 64 | ######################################## |
| @@ -59,30 +69,28 @@ | |
| 69 | fossil mv ../f1 . |
| 70 | test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"} |
| 71 | |
| 72 | fossil revert |
| 73 | test mv-soft-relative-2 { |
| 74 | [normalize_result] eq "DELETE: subdir1/f1\nREVERTED: f1${undoMsg}" |
| 75 | } |
| 76 | |
| 77 | cd $rootDir |
| 78 | |
| 79 | ################################### |
| 80 | # Test 2: Soft Move Relative File # |
| 81 | ################################### |
| 82 | |
| 83 | file mkdir [file join $rootDir subdir2] |
| 84 | cd [file join $rootDir subdir2] |
| 85 | |
| 86 | fossil mv ../f2 ./f2 |
| 87 | test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"} |
| 88 | |
| 89 | fossil revert |
| 90 | test mv-soft-relative-4 { |
| 91 | [normalize_result] eq "DELETE: subdir2/f2\nREVERTED: f2${undoMsg}" |
| 92 | } |
| 93 | |
| 94 | cd $rootDir |
| 95 | |
| 96 | ######################################## |
| @@ -92,39 +100,35 @@ | |
| 100 | file mkdir [file join $rootDir subdir3] |
| 101 | cd [file join $rootDir subdir3] |
| 102 | |
| 103 | fossil mv --hard ../f3 . |
| 104 | test mv-hard-relative-1 { |
| 105 | [normalize_result] eq "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3" |
| 106 | } |
| 107 | |
| 108 | fossil revert |
| 109 | test mv-hard-relative-2 { |
| 110 | [normalize_result] eq "DELETE: subdir3/f3\nREVERTED: f3${undoMsg}" |
| 111 | } |
| 112 | |
| 113 | cd $rootDir |
| 114 | |
| 115 | ################################### |
| 116 | # Test 4: Hard Move Relative File # |
| 117 | ################################### |
| 118 | |
| 119 | file mkdir [file join $rootDir subdir4] |
| 120 | cd [file join $rootDir subdir4] |
| 121 | |
| 122 | fossil mv --hard ../f4 ./f4 |
| 123 | test mv-hard-relative-3 { |
| 124 | [normalize_result] eq "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4" |
| 125 | } |
| 126 | |
| 127 | fossil revert |
| 128 | test mv-hard-relative-4 { |
| 129 | [normalize_result] eq "DELETE: subdir4/f4\nREVERTED: f4${undoMsg}" |
| 130 | } |
| 131 | |
| 132 | cd $rootDir |
| 133 | |
| 134 | ######################################## |
| @@ -137,30 +141,28 @@ | |
| 141 | fossil mv [file join $rootDir f5] [file join $rootDir subdir5] |
| 142 | test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"} |
| 143 | |
| 144 | fossil revert |
| 145 | test mv-soft-absolute-2 { |
| 146 | [normalize_result] eq "DELETE: subdir5/f5\nREVERTED: f5${undoMsg}" |
| 147 | } |
| 148 | |
| 149 | cd $rootDir |
| 150 | |
| 151 | ################################### |
| 152 | # Test 6: Soft Move Absolute File # |
| 153 | ################################### |
| 154 | |
| 155 | file mkdir [file join $rootDir subdir6] |
| 156 | cd [file join $rootDir subdir6] |
| 157 | |
| 158 | fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6] |
| 159 | test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"} |
| 160 | |
| 161 | fossil revert |
| 162 | test mv-soft-absolute-4 { |
| 163 | [normalize_result] eq "DELETE: subdir6/f6\nREVERTED: f6${undoMsg}" |
| 164 | } |
| 165 | |
| 166 | cd $rootDir |
| 167 | |
| 168 | ######################################## |
| @@ -170,37 +172,221 @@ | |
| 172 | file mkdir [file join $rootDir subdir7] |
| 173 | cd [file join $rootDir subdir7] |
| 174 | |
| 175 | fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7] |
| 176 | test mv-hard-absolute-1 { |
| 177 | [normalize_result] eq "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7" |
| 178 | } |
| 179 | |
| 180 | fossil revert |
| 181 | test mv-hard-absolute-2 { |
| 182 | [normalize_result] eq "DELETE: subdir7/f7\nREVERTED: f7${undoMsg}" |
| 183 | } |
| 184 | |
| 185 | cd $rootDir |
| 186 | |
| 187 | ################################### |
| 188 | # Test 8: Hard Move Absolute File # |
| 189 | ################################### |
| 190 | |
| 191 | file mkdir [file join $rootDir subdir8] |
| 192 | cd [file join $rootDir subdir8] |
| 193 | |
| 194 | fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8] |
| 195 | test mv-hard-absolute-3 { |
| 196 | [normalize_result] eq "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8" |
| 197 | } |
| 198 | |
| 199 | fossil revert |
| 200 | test mv-hard-absolute-4 { |
| 201 | [normalize_result] eq "DELETE: subdir8/f8\nREVERTED: f8${undoMsg}" |
| 202 | } |
| 203 | |
| 204 | cd $rootDir |
| 205 | |
| 206 | ########################################## |
| 207 | # Test 9: Soft Remove Relative Directory # |
| 208 | ########################################## |
| 209 | |
| 210 | file mkdir [file join $rootDir subdir1] |
| 211 | cd [file join $rootDir subdir1] |
| 212 | |
| 213 | fossil rm ../subdirA |
| 214 | test rm-soft-relative-1 {$RESULT eq ""} |
| 215 | |
| 216 | fossil rm ../subdirB |
| 217 | test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"} |
| 218 | |
| 219 | fossil rm ../subdirC |
| 220 | test rm-soft-relative-3 { |
| 221 | [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11" |
| 222 | } |
| 223 | |
| 224 | fossil revert |
| 225 | test rm-soft-relative-4 { |
| 226 | [normalize_result] eq \ |
| 227 | "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" |
| 228 | } |
| 229 | |
| 230 | cd $rootDir |
| 231 | |
| 232 | ###################################### |
| 233 | # Test 10: Soft Remove Relative File # |
| 234 | ###################################### |
| 235 | |
| 236 | file mkdir [file join $rootDir subdir2] |
| 237 | cd [file join $rootDir subdir2] |
| 238 | |
| 239 | fossil rm ../f2 |
| 240 | test rm-soft-relative-5 {$RESULT eq "DELETED f2"} |
| 241 | |
| 242 | fossil revert |
| 243 | test rm-soft-relative-6 { |
| 244 | [normalize_result] eq "REVERTED: f2${undoMsg}" |
| 245 | } |
| 246 | |
| 247 | cd $rootDir |
| 248 | |
| 249 | ########################################### |
| 250 | # Test 11: Hard Remove Relative Directory # |
| 251 | ########################################### |
| 252 | |
| 253 | file mkdir [file join $rootDir subdir3] |
| 254 | cd [file join $rootDir subdir3] |
| 255 | |
| 256 | fossil rm --hard ../subdirA |
| 257 | test rm-hard-relative-1 { |
| 258 | [normalize_result] eq "" |
| 259 | } |
| 260 | |
| 261 | fossil rm --hard ../subdirB |
| 262 | test rm-hard-relative-2 { |
| 263 | [normalize_result] eq \ |
| 264 | "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9" |
| 265 | } |
| 266 | |
| 267 | fossil rm --hard ../subdirC |
| 268 | test rm-hard-relative-3 { |
| 269 | [normalize_result] eq \ |
| 270 | "DELETED subdirC/f10\nDELETED subdirC/f11\nDELETED_FILE\ |
| 271 | ${rootDir}/subdirC/f10\nDELETED_FILE ${rootDir}/subdirC/f11" |
| 272 | } |
| 273 | |
| 274 | fossil revert |
| 275 | test rm-hard-relative-4 { |
| 276 | [normalize_result] eq \ |
| 277 | "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" |
| 278 | } |
| 279 | |
| 280 | cd $rootDir |
| 281 | |
| 282 | ###################################### |
| 283 | # Test 12: Hard Remove Relative File # |
| 284 | ###################################### |
| 285 | |
| 286 | file mkdir [file join $rootDir subdir4] |
| 287 | cd [file join $rootDir subdir4] |
| 288 | |
| 289 | fossil rm --hard ../f4 |
| 290 | test rm-hard-relative-5 { |
| 291 | [normalize_result] eq "DELETED f4\nDELETED_FILE ${rootDir}/f4" |
| 292 | } |
| 293 | |
| 294 | fossil revert |
| 295 | test rm-hard-relative-6 { |
| 296 | [normalize_result] eq "REVERTED: f4${undoMsg}" |
| 297 | } |
| 298 | |
| 299 | cd $rootDir |
| 300 | |
| 301 | ########################################### |
| 302 | # Test 13: Soft Remove Absolute Directory # |
| 303 | ########################################### |
| 304 | |
| 305 | file mkdir [file join $rootDir subdir5] |
| 306 | cd [file join $rootDir subdir5] |
| 307 | |
| 308 | fossil rm [file join $rootDir subdirA] |
| 309 | test rm-soft-absolute-1 {$RESULT eq ""} |
| 310 | |
| 311 | fossil rm [file join $rootDir subdirB] |
| 312 | test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"} |
| 313 | |
| 314 | fossil rm [file join $rootDir subdirC] |
| 315 | test rm-soft-absolute-3 { |
| 316 | [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11" |
| 317 | } |
| 318 | |
| 319 | fossil revert |
| 320 | test rm-soft-absolute-4 { |
| 321 | [normalize_result] eq \ |
| 322 | "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" |
| 323 | } |
| 324 | |
| 325 | cd $rootDir |
| 326 | |
| 327 | ###################################### |
| 328 | # Test 14: Soft Remove Absolute File # |
| 329 | ###################################### |
| 330 | |
| 331 | file mkdir [file join $rootDir subdir6] |
| 332 | cd [file join $rootDir subdir6] |
| 333 | |
| 334 | fossil rm [file join $rootDir f6] |
| 335 | test rm-soft-absolute-5 {$RESULT eq "DELETED f6"} |
| 336 | |
| 337 | fossil revert |
| 338 | test rm-soft-absolute-6 { |
| 339 | [normalize_result] eq "REVERTED: f6${undoMsg}" |
| 340 | } |
| 341 | |
| 342 | cd $rootDir |
| 343 | |
| 344 | ########################################### |
| 345 | # Test 15: Hard Remove Absolute Directory # |
| 346 | ########################################### |
| 347 | |
| 348 | file mkdir [file join $rootDir subdir7] |
| 349 | cd [file join $rootDir subdir7] |
| 350 | |
| 351 | fossil rm --hard [file join $rootDir subdirA] |
| 352 | test rm-hard-absolute-1 {$RESULT eq ""} |
| 353 | |
| 354 | fossil rm --hard [file join $rootDir subdirB] |
| 355 | test rm-hard-absolute-2 { |
| 356 | [normalize_result] eq \ |
| 357 | "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9" |
| 358 | } |
| 359 | |
| 360 | fossil rm --hard [file join $rootDir subdirC] |
| 361 | test rm-hard-absolute-3 { |
| 362 | [normalize_result] eq \ |
| 363 | "DELETED subdirC/f10\nDELETED subdirC/f11\nDELETED_FILE\ |
| 364 | ${rootDir}/subdirC/f10\nDELETED_FILE ${rootDir}/subdirC/f11" |
| 365 | } |
| 366 | |
| 367 | fossil revert |
| 368 | test rm-hard-absolute-4 { |
| 369 | [normalize_result] eq \ |
| 370 | "REVERTED: subdirB/f9\nREVERTED: subdirC/f10\nREVERTED: subdirC/f11${undoMsg}" |
| 371 | } |
| 372 | |
| 373 | cd $rootDir |
| 374 | |
| 375 | ###################################### |
| 376 | # Test 16: Hard Remove Absolute File # |
| 377 | ###################################### |
| 378 | |
| 379 | file mkdir [file join $rootDir subdir8] |
| 380 | cd [file join $rootDir subdir8] |
| 381 | |
| 382 | fossil rm --hard [file join $rootDir f8] |
| 383 | test rm-hard-absolute-5 { |
| 384 | [normalize_result] eq "DELETED f8\nDELETED_FILE ${rootDir}/f8" |
| 385 | } |
| 386 | |
| 387 | fossil revert |
| 388 | test rm-hard-absolute-6 { |
| 389 | [normalize_result] eq "REVERTED: f8${undoMsg}" |
| 390 | } |
| 391 | |
| 392 | cd $rootDir |
| 393 |