diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2026-04-23 15:27:20 +0100 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2026-04-23 15:27:20 +0100 |
| commit | 0a04a4bc7a852d12ecaa2edaeafa5221588d120a (patch) | |
| tree | 4cff960268d257471e464cd80c86a65eb963a436 /test/lisp | |
| parent | baa52744457222ebe621b11eb997a5fc4bd67293 (diff) | |
vc-hg-after-dir-status: Rewrite to handle current 'hg status' output
* lisp/vc/vc-hg.el (vc-hg-after-dir-status): Rewrite to handle
renames where the "R" line comes arbitrarily later in the
output.
* test/lisp/vc/vc-hg-tests.el
(vc-hg-test--after-dir-status-expect): New function.
(vc-hg-after-dir-status): New test.
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/vc/vc-hg-tests.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el index 76df75cb8d1..0216c23eebe 100644 --- a/test/lisp/vc/vc-hg-tests.el +++ b/test/lisp/vc/vc-hg-tests.el @@ -57,4 +57,35 @@ (vc-annotate-convert-time (encode-time 0 0 0 28 11 2014)))))) +(defun vc-hg-test--after-dir-status-expect (in out) + "Call `vc-hg-after-dir-status' on IN and assert that it returns OUT." + (with-temp-buffer + (insert in) + (vc-hg-after-dir-status (lambda (res) (should (equal res out)))))) + +(ert-deftest vc-hg-after-dir-status () + "Test `vc-hg-after-dir-status'." + (vc-hg-test--after-dir-status-expect + "\ +A bar2 + bar +A foo2 + foo +R bar" + '(("bar" removed #s(vc-hg-extra-fileinfo renamed-to "bar2")) + ("foo2" added #s(vc-hg-extra-fileinfo copied "foo")) + ("bar2" added #s(vc-hg-extra-fileinfo renamed-from "bar")))) + (vc-hg-test--after-dir-status-expect + "\ +A bar2 + bar +A foo2 + foo +R bar +R foo" + '(("foo" removed #s(vc-hg-extra-fileinfo renamed-to "foo2")) + ("bar" removed #s(vc-hg-extra-fileinfo renamed-to "bar2")) + ("foo2" added #s(vc-hg-extra-fileinfo renamed-from "foo")) + ("bar2" added #s(vc-hg-extra-fileinfo renamed-from "bar"))))) + ;;; vc-hg-tests.el ends here |
