aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMiha Rihtaršič2021-10-26 10:54:54 +0200
committerLars Ingebrigtsen2021-10-27 15:41:32 +0200
commit3fac3120f8ba7941bac89fa90f30140492fdf0eb (patch)
tree27639c898ed6f39e4dfa657e3075824974fc4dcd /test
parent65cd2d90b7a894c184f45bfff52b7c6200ebc639 (diff)
downloademacs-3fac3120f8ba7941bac89fa90f30140492fdf0eb.tar.gz
emacs-3fac3120f8ba7941bac89fa90f30140492fdf0eb.zip
Allow matching non-.git gitlab and gitea URLs in bug-reference
* lisp/progmodes/bug-reference.el (bug-reference--build-forge-setup-entry): Allow matching non-.git gitlab and gitea URLs, with and without slashes (bug#51316).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/bug-reference-tests.el74
1 files changed, 70 insertions, 4 deletions
diff --git a/test/lisp/progmodes/bug-reference-tests.el b/test/lisp/progmodes/bug-reference-tests.el
index 7a355509a1d..7a3ab5fbda0 100644
--- a/test/lisp/progmodes/bug-reference-tests.el
+++ b/test/lisp/progmodes/bug-reference-tests.el
@@ -26,12 +26,26 @@
26(require 'bug-reference) 26(require 'bug-reference)
27(require 'ert) 27(require 'ert)
28 28
29(defun test--get-github-entry (protocol) 29(defun test--get-github-entry (url)
30 (and (string-match 30 (and (string-match
31 (car (bug-reference--build-forge-setup-entry 31 (car (bug-reference--build-forge-setup-entry
32 "github.com" 'github protocol)) 32 "github.com" 'github "https"))
33 protocol) 33 url)
34 (match-string 1 protocol))) 34 (match-string 1 url)))
35
36(defun test--get-gitlab-entry (url)
37 (and (string-match
38 (car (bug-reference--build-forge-setup-entry
39 "gitlab.com" 'gitlab "https"))
40 url)
41 (match-string 1 url)))
42
43(defun test--get-gitea-entry (url)
44 (and (string-match
45 (car (bug-reference--build-forge-setup-entry
46 "gitea.com" 'gitea "https"))
47 url)
48 (match-string 1 url)))
35 49
36(ert-deftest test-github-entry () 50(ert-deftest test-github-entry ()
37 (should 51 (should
@@ -59,4 +73,56 @@
59 (test--get-github-entry "https://github.com/magit/magit/") 73 (test--get-github-entry "https://github.com/magit/magit/")
60 "magit/magit"))) 74 "magit/magit")))
61 75
76(ert-deftest test-gitlab-entry ()
77 (should
78 (equal
79 (test--get-gitlab-entry "git@gitlab.com:larsmagne/csid.git")
80 "larsmagne/csid"))
81 (should
82 (equal
83 (test--get-gitlab-entry "git@gitlab.com:larsmagne/csid")
84 "larsmagne/csid"))
85 (should
86 (equal
87 (test--get-gitlab-entry "https://gitlab.com/magit/magit.git")
88 "magit/magit"))
89 (should
90 (equal
91 (test--get-gitlab-entry "https://gitlab.com/magit/magit.git/")
92 "magit/magit"))
93 (should
94 (equal
95 (test--get-gitlab-entry "https://gitlab.com/magit/magit")
96 "magit/magit"))
97 (should
98 (equal
99 (test--get-gitlab-entry "https://gitlab.com/magit/magit/")
100 "magit/magit")))
101
102(ert-deftest test-gitea-entry ()
103 (should
104 (equal
105 (test--get-gitea-entry "git@gitea.com:larsmagne/csid.git")
106 "larsmagne/csid"))
107 (should
108 (equal
109 (test--get-gitea-entry "git@gitea.com:larsmagne/csid")
110 "larsmagne/csid"))
111 (should
112 (equal
113 (test--get-gitea-entry "https://gitea.com/magit/magit.git")
114 "magit/magit"))
115 (should
116 (equal
117 (test--get-gitea-entry "https://gitea.com/magit/magit.git/")
118 "magit/magit"))
119 (should
120 (equal
121 (test--get-gitea-entry "https://gitea.com/magit/magit")
122 "magit/magit"))
123 (should
124 (equal
125 (test--get-gitea-entry "https://gitea.com/magit/magit/")
126 "magit/magit")))
127
62;;; bug-reference-tests.el ends here 128;;; bug-reference-tests.el ends here