diff options
author | Miha Rihtaršič <miha@kamnitnik.top> | 2021-10-26 10:54:54 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-27 15:41:32 +0200 |
commit | 3fac3120f8ba7941bac89fa90f30140492fdf0eb (patch) | |
tree | 27639c898ed6f39e4dfa657e3075824974fc4dcd /test/lisp/progmodes/bug-reference-tests.el | |
parent | 65cd2d90b7a894c184f45bfff52b7c6200ebc639 (diff) | |
download | emacs-3fac3120f8ba7941bac89fa90f30140492fdf0eb.tar.gz emacs-3fac3120f8ba7941bac89fa90f30140492fdf0eb.tar.bz2 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/lisp/progmodes/bug-reference-tests.el')
-rw-r--r-- | test/lisp/progmodes/bug-reference-tests.el | 74 |
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 @@ (require 'bug-reference) (require 'ert) -(defun test--get-github-entry (protocol) +(defun test--get-github-entry (url) (and (string-match (car (bug-reference--build-forge-setup-entry - "github.com" 'github protocol)) - protocol) - (match-string 1 protocol))) + "github.com" 'github "https")) + url) + (match-string 1 url))) + +(defun test--get-gitlab-entry (url) + (and (string-match + (car (bug-reference--build-forge-setup-entry + "gitlab.com" 'gitlab "https")) + url) + (match-string 1 url))) + +(defun test--get-gitea-entry (url) + (and (string-match + (car (bug-reference--build-forge-setup-entry + "gitea.com" 'gitea "https")) + url) + (match-string 1 url))) (ert-deftest test-github-entry () (should @@ -59,4 +73,56 @@ (test--get-github-entry "https://github.com/magit/magit/") "magit/magit"))) +(ert-deftest test-gitlab-entry () + (should + (equal + (test--get-gitlab-entry "git@gitlab.com:larsmagne/csid.git") + "larsmagne/csid")) + (should + (equal + (test--get-gitlab-entry "git@gitlab.com:larsmagne/csid") + "larsmagne/csid")) + (should + (equal + (test--get-gitlab-entry "https://gitlab.com/magit/magit.git") + "magit/magit")) + (should + (equal + (test--get-gitlab-entry "https://gitlab.com/magit/magit.git/") + "magit/magit")) + (should + (equal + (test--get-gitlab-entry "https://gitlab.com/magit/magit") + "magit/magit")) + (should + (equal + (test--get-gitlab-entry "https://gitlab.com/magit/magit/") + "magit/magit"))) + +(ert-deftest test-gitea-entry () + (should + (equal + (test--get-gitea-entry "git@gitea.com:larsmagne/csid.git") + "larsmagne/csid")) + (should + (equal + (test--get-gitea-entry "git@gitea.com:larsmagne/csid") + "larsmagne/csid")) + (should + (equal + (test--get-gitea-entry "https://gitea.com/magit/magit.git") + "magit/magit")) + (should + (equal + (test--get-gitea-entry "https://gitea.com/magit/magit.git/") + "magit/magit")) + (should + (equal + (test--get-gitea-entry "https://gitea.com/magit/magit") + "magit/magit")) + (should + (equal + (test--get-gitea-entry "https://gitea.com/magit/magit/") + "magit/magit"))) + ;;; bug-reference-tests.el ends here |