aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/vc/vc-tests.el55
1 files changed, 16 insertions, 39 deletions
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index 793ad82c74f..ac10ce2337a 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -316,46 +316,31 @@ This checks also `vc-backend' and `vc-responsible-backend'."
316 'vc-test--cleanup-hook 316 'vc-test--cleanup-hook
317 `(lambda () (delete-directory ,default-directory 'recursive))) 317 `(lambda () (delete-directory ,default-directory 'recursive)))
318 318
319 ;; Create empty repository. Check repository state. 319 ;; Create empty repository.
320 (make-directory default-directory) 320 (make-directory default-directory)
321 (vc-test--create-repo-function backend) 321 (vc-test--create-repo-function backend)
322 322
323 ;; FIXME: The state shall be unregistered only.
324 ;; nil: RCS
325 ;; unregistered: Bzr CVS Git Hg Mtn SCCS SRC
326 ;; up-to-date: SVN
327 (message "vc-state1 %s" (vc-state default-directory))
328 (should (eq (vc-state default-directory)
329 (vc-state default-directory backend)))
330 (should (memq (vc-state default-directory)
331 '(nil unregistered up-to-date)))
332
333 (let ((tmp-name (expand-file-name "foo" default-directory))) 323 (let ((tmp-name (expand-file-name "foo" default-directory)))
334 ;; Check state of a nonexistent file. 324 ;; Check state of a nonexistent file.
335 325
336 ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN
337 (message "vc-state2 %s" (vc-state tmp-name)) 326 (message "vc-state2 %s" (vc-state tmp-name))
338 (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) 327 (should (null (vc-state tmp-name)))
339 (should (eq (vc-state tmp-name) 'unregistered))
340 328
341 ;; Write a new file. Check state. 329 ;; Write a new file. Check state.
342 (write-region "foo" nil tmp-name nil 'nomessage) 330 (write-region "foo" nil tmp-name nil 'nomessage)
343 331
344 ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN
345 (message "vc-state3 %s" (vc-state tmp-name)) 332 (message "vc-state3 %s" (vc-state tmp-name))
346 (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) 333 (should (null (vc-state tmp-name)))
347 (should (eq (vc-state tmp-name) 'unregistered))
348 334
349 ;; Register a file. Check state. 335 ;; Register a file. Check state.
350 (vc-register 336 (vc-register
351 (list backend (list (file-name-nondirectory tmp-name)))) 337 (list backend (list (file-name-nondirectory tmp-name))))
352 338
353 ;; FIXME: nil seems to be wrong. 339 ;; FIXME: nil is definitely wrong.
354 ;; nil: SRC 340 ;; nil: SRC
355 ;; added: Bzr CVS Git Hg Mtn SVN 341 ;; added: Bzr CVS Git Hg Mtn SVN
356 ;; up-to-date: RCS SCCS 342 ;; up-to-date: RCS SCCS
357 (message "vc-state4 %s" (vc-state tmp-name)) 343 (message "vc-state4 %s" (vc-state tmp-name))
358 (should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
359 (should (memq (vc-state tmp-name) '(nil added up-to-date))) 344 (should (memq (vc-state tmp-name) '(nil added up-to-date)))
360 345
361 ;; Unregister the file. Check state. 346 ;; Unregister the file. Check state.
@@ -363,11 +348,10 @@ This checks also `vc-backend' and `vc-responsible-backend'."
363 'vc-test--unregister-function backend tmp-name) 348 'vc-test--unregister-function backend tmp-name)
364 'vc-not-supported) 349 'vc-not-supported)
365 (message "vc-state5 unsupported") 350 (message "vc-state5 unsupported")
366 ;; unregistered: Bzr Git Hg RCS 351 ;; nil: Bzr Git Hg RCS
367 ;; unsupported: CVS Mtn SCCS SRC SVN 352 ;; unsupported: CVS Mtn SCCS SRC SVN
368 (message "vc-state5 %s" (vc-state tmp-name)) 353 (message "vc-state5 %s" (vc-state tmp-name))
369 (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) 354 (should (null (vc-state tmp-name))))))
370 (should (memq (vc-state tmp-name) '(unregistered))))))
371 355
372 ;; Save exit. 356 ;; Save exit.
373 (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) 357 (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
@@ -399,41 +383,36 @@ This checks also `vc-backend' and `vc-responsible-backend'."
399 ;; "0": SVN 383 ;; "0": SVN
400 (message 384 (message
401 "vc-working-revision1 %s" (vc-working-revision default-directory)) 385 "vc-working-revision1 %s" (vc-working-revision default-directory))
402 (should (eq (vc-working-revision default-directory) 386 (should (member (vc-working-revision default-directory) '(nil "0")))
403 (vc-working-revision default-directory backend)))
404 (should (member (vc-working-revision default-directory) '(nil "0")))
405 387
406 (let ((tmp-name (expand-file-name "foo" default-directory))) 388 (let ((tmp-name (expand-file-name "foo" default-directory)))
407 ;; Check initial working revision, should be nil until 389 ;; Check initial working revision, should be nil until
408 ;; it's registered. 390 ;; it's registered.
409 391
410 ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN
411 (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) 392 (message "vc-working-revision2 %s" (vc-working-revision tmp-name))
412 (should (eq (vc-working-revision tmp-name) 393 (should-not (vc-working-revision tmp-name))
413 (vc-working-revision tmp-name backend)))
414 (should-not (vc-working-revision tmp-name))
415 394
416 ;; Write a new file. Check working revision. 395 ;; Write a new file. Check working revision.
417 (write-region "foo" nil tmp-name nil 'nomessage) 396 (write-region "foo" nil tmp-name nil 'nomessage)
418 397
419 ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN
420 (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) 398 (message "vc-working-revision3 %s" (vc-working-revision tmp-name))
421 (should (eq (vc-working-revision tmp-name) 399 (should-not (vc-working-revision tmp-name))
422 (vc-working-revision tmp-name backend)))
423 (should-not (vc-working-revision tmp-name))
424 400
425 ;; Register a file. Check working revision. 401 ;; Register a file. Check working revision.
426 (vc-register 402 (vc-register
427 (list backend (list (file-name-nondirectory tmp-name)))) 403 (list backend (list (file-name-nondirectory tmp-name))))
428 404
429 ;; FIXME: nil doesn't seem to be proper. 405 ;; XXX: nil is fine, at least in Git's case, because
406 ;; `vc-register' only makes the file `added' in this case.
430 ;; nil: Git Mtn 407 ;; nil: Git Mtn
431 ;; "0": Bzr CVS Hg SRC SVN 408 ;; "0": Bzr CVS Hg SRC SVN
432 ;; "1.1": RCS SCCS 409 ;; "1.1": RCS SCCS
433 (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) 410 (message "vc-working-revision4 %s" (vc-working-revision tmp-name))
434 (should (eq (vc-working-revision tmp-name) 411 (should (member (vc-working-revision tmp-name) '(nil "0" "1.1")))
435 (vc-working-revision tmp-name backend))) 412
436 (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) 413 ;; TODO: Call `vc-checkin', and check the resulting
414 ;; working revision. None of the return values should be
415 ;; nil then.
437 416
438 ;; Unregister the file. Check working revision. 417 ;; Unregister the file. Check working revision.
439 (if (eq (vc-test--run-maybe-unsupported-function 418 (if (eq (vc-test--run-maybe-unsupported-function
@@ -443,8 +422,6 @@ This checks also `vc-backend' and `vc-responsible-backend'."
443 ;; nil: Bzr Git Hg RCS 422 ;; nil: Bzr Git Hg RCS
444 ;; unsupported: CVS Mtn SCCS SRC SVN 423 ;; unsupported: CVS Mtn SCCS SRC SVN
445 (message "vc-working-revision5 %s" (vc-working-revision tmp-name)) 424 (message "vc-working-revision5 %s" (vc-working-revision tmp-name))
446 (should (eq (vc-working-revision tmp-name)
447 (vc-working-revision tmp-name backend)))
448 (should-not (vc-working-revision tmp-name))))) 425 (should-not (vc-working-revision tmp-name)))))
449 426
450 ;; Save exit. 427 ;; Save exit.