diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2016-04-24 23:32:48 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2016-04-24 23:34:09 +0300 |
commit | 1face76ba6d19b269310ddbb0a6a618a3bfe54a2 (patch) | |
tree | ae4c3973dba7915bdf2053f76b871e5feaeb2f54 /test/lisp/vc | |
parent | dba65ec99361a534042e3a1ade4d08b0f40481d1 (diff) | |
download | emacs-1face76ba6d19b269310ddbb0a6a618a3bfe54a2.tar.gz |
Revert the disputed VC change and update the tests
* lisp/vc/vc-hooks.el (vc-working-revision):
Remove the previous change.
(vc-state): Same. And update the old, incorrect comment about
unregistered files
(http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00526.html).
* test/lisp/vc/vc-tests.el (vc-test--state): Remove the check
calling `vc-state' on default-directory (VC state is undefined
for directories). Check that `vc-state' returns nil where it
returned `unregistered' before. Remove all checks comparing
invocations with the backend passed in explictly and without.
(vc-test--working-revision): Remove all checks comparing
invocations with the backend passed in explictly and without.
Update comments, and add a new one.
Diffstat (limited to 'test/lisp/vc')
-rw-r--r-- | test/lisp/vc/vc-tests.el | 55 |
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'." 'vc-test--cleanup-hook `(lambda () (delete-directory ,default-directory 'recursive))) - ;; Create empty repository. Check repository state. + ;; Create empty repository. (make-directory default-directory) (vc-test--create-repo-function backend) - ;; FIXME: The state shall be unregistered only. - ;; nil: RCS - ;; unregistered: Bzr CVS Git Hg Mtn SCCS SRC - ;; up-to-date: SVN - (message "vc-state1 %s" (vc-state default-directory)) - (should (eq (vc-state default-directory) - (vc-state default-directory backend))) - (should (memq (vc-state default-directory) - '(nil unregistered up-to-date))) - (let ((tmp-name (expand-file-name "foo" default-directory))) ;; Check state of a nonexistent file. - ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN (message "vc-state2 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (eq (vc-state tmp-name) 'unregistered)) + (should (null (vc-state tmp-name))) ;; Write a new file. Check state. (write-region "foo" nil tmp-name nil 'nomessage) - ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN (message "vc-state3 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (eq (vc-state tmp-name) 'unregistered)) + (should (null (vc-state tmp-name))) ;; Register a file. Check state. (vc-register (list backend (list (file-name-nondirectory tmp-name)))) - ;; FIXME: nil seems to be wrong. + ;; FIXME: nil is definitely wrong. ;; nil: SRC ;; added: Bzr CVS Git Hg Mtn SVN ;; up-to-date: RCS SCCS (message "vc-state4 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) (should (memq (vc-state tmp-name) '(nil added up-to-date))) ;; Unregister the file. Check state. @@ -363,11 +348,10 @@ This checks also `vc-backend' and `vc-responsible-backend'." 'vc-test--unregister-function backend tmp-name) 'vc-not-supported) (message "vc-state5 unsupported") - ;; unregistered: Bzr Git Hg RCS + ;; nil: Bzr Git Hg RCS ;; unsupported: CVS Mtn SCCS SRC SVN (message "vc-state5 %s" (vc-state tmp-name)) - (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) '(unregistered)))))) + (should (null (vc-state tmp-name)))))) ;; Save exit. (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) @@ -399,41 +383,36 @@ This checks also `vc-backend' and `vc-responsible-backend'." ;; "0": SVN (message "vc-working-revision1 %s" (vc-working-revision default-directory)) - (should (eq (vc-working-revision default-directory) - (vc-working-revision default-directory backend))) - (should (member (vc-working-revision default-directory) '(nil "0"))) + (should (member (vc-working-revision default-directory) '(nil "0"))) (let ((tmp-name (expand-file-name "foo" default-directory))) ;; Check initial working revision, should be nil until ;; it's registered. - ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) - (should-not (vc-working-revision tmp-name)) + (should-not (vc-working-revision tmp-name)) ;; Write a new file. Check working revision. (write-region "foo" nil tmp-name nil 'nomessage) - ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) - (should-not (vc-working-revision tmp-name)) + (should-not (vc-working-revision tmp-name)) ;; Register a file. Check working revision. (vc-register (list backend (list (file-name-nondirectory tmp-name)))) - ;; FIXME: nil doesn't seem to be proper. + ;; XXX: nil is fine, at least in Git's case, because + ;; `vc-register' only makes the file `added' in this case. ;; nil: Git Mtn ;; "0": Bzr CVS Hg SRC SVN ;; "1.1": RCS SCCS (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) - (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) + (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) + + ;; TODO: Call `vc-checkin', and check the resulting + ;; working revision. None of the return values should be + ;; nil then. ;; Unregister the file. Check working revision. (if (eq (vc-test--run-maybe-unsupported-function @@ -443,8 +422,6 @@ This checks also `vc-backend' and `vc-responsible-backend'." ;; nil: Bzr Git Hg RCS ;; unsupported: CVS Mtn SCCS SRC SVN (message "vc-working-revision5 %s" (vc-working-revision tmp-name)) - (should (eq (vc-working-revision tmp-name) - (vc-working-revision tmp-name backend))) (should-not (vc-working-revision tmp-name))))) ;; Save exit. |