1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| | ;;; vc-cvs-tests.el --- tests for vc/vc-cvs.el -*- lexical-binding:t -*-
;; Copyright (C) 2023 Free Software Foundation, Inc.
;; Author: Olivier Certner <olce.emacs@certner.fr>
;; Maintainer: emacs-devel@gnu.org
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'vc-cvs)
(ert-deftest vc-cvs-test-parse-root--local-no-method ()
(vc-cvs-test--check-parse-root
"/home/joe/repo"
'("local" nil nil "/home/joe/repo")))
(ert-deftest vc-cvs-test-parse-root--local-windows-drive-letter ()
(vc-cvs-test--check-parse-root
":local:c:/users/joe/repo"
'("local" nil nil "c:/users/joe/repo")))
(ert-deftest vc-cvs-test-parse-root--ext-no-method-host-no-port-colon ()
(vc-cvs-test--check-parse-root
"host/home/serv/repo"
'("ext" nil "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--pserver-host-no-port-colon ()
(vc-cvs-test--check-parse-root
":pserver:host/home/serv/repo"
'("pserver" nil "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--pserver-host-port-colon ()
(vc-cvs-test--check-parse-root
":pserver:host:/home/serv/repo"
'("pserver" nil "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--ext-no-method-user-host-no-port-colon ()
(vc-cvs-test--check-parse-root
"usr@host/home/serv/repo"
'("ext" "usr" "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--ext-no-method-user-host-port-colon ()
(vc-cvs-test--check-parse-root
"usr@host:/home/serv/repo"
'("ext" "usr" "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--pserver-user-password-host-no-port-colon ()
(vc-cvs-test--check-parse-root
":pserver:usr:passwd@host/home/serv/repo"
'("pserver" "usr" "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--pserver-user-password-host-port-colon ()
(vc-cvs-test--check-parse-root
":pserver:usr:passwd@host:/home/serv/repo"
'("pserver" "usr" "host" "/home/serv/repo")))
(ert-deftest vc-cvs-test-parse-root--pserver-user-password-host-port ()
(vc-cvs-test--check-parse-root
":pserver:usr:passwd@host:28/home/serv/repo"
'("pserver" "usr" "host" "/home/serv/repo")))
;; Next 3 tests are just to err on the side of caution. It doesn't
;; seem that CVS 1.12 can ever produce such lines.
(ert-deftest
vc-cvs-test-parse-root--ext-no-method-user-password-host-no-port-colon
()
(vc-cvs-test--check-parse-root
"usr:passwd@host/home/serv/repo"
'("ext" "usr" "host" "/home/serv/repo")))
(ert-deftest
vc-cvs-test-parse-root--ext-no-method-user-password-host-port-colon
()
(vc-cvs-test--check-parse-root
"usr:passwd@host:/home/serv/repo"
'("ext" "usr" "host" "/home/serv/repo")))
(ert-deftest
vc-cvs-test-parse-root--ext-no-method-user-password-host-port
()
(vc-cvs-test--check-parse-root
"usr:passwd@host:28/home/serv/repo"
'("ext" "usr" "host" "/home/serv/repo")))
(defun vc-cvs-test--check-parse-root (input expected-output)
(should (equal (vc-cvs-parse-root input) expected-output)))
;;; vc-cvs-tests.el ends here
|