/
git-link-test.el
68 lines (46 loc) · 3.04 KB
/
git-link-test.el
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
;; Tests for git-link
(require 'ert)
(require 'git-link)
(ert-deftest git-link--parse-remote-test ()
(should (equal '("foo" "")
(git-link--parse-remote "foo")))
(should (equal '("github.com" "")
(git-link--parse-remote "https://github.com")))
(should (equal '("github.com" "/")
(git-link--parse-remote "https://github.com/")))
(should (equal '("github.com" "sshaw_/selfie_formatter")
(git-link--parse-remote "git@github.com:sshaw_/selfie_formatter.git")))
(should (equal '("github.com" "ruby/ruby")
(git-link--parse-remote "https://github.com/ruby/ruby.git")))
(should (equal '("github.com" "sshaw/copy-as-format")
(git-link--parse-remote "https://github.com:9999/sshaw/copy-as-format.git")))
(should (equal '("github.com" "ScreenStaring/Some-Thing")
(git-link--parse-remote "git@github.com:ScreenStaring/Some-Thing.git")))
(should (equal '("orgmode.org" "org-mode")
(git-link--parse-remote "https://orgmode.org/org-mode.git")))
(should (equal '("gitlab.com" "weshmashian/emacs.d")
(git-link--parse-remote "https://gitlab.com/weshmashian/emacs.d")))
(should (equal '("codeberg.org" "takeonrules/emacs.d")
(git-link--parse-remote "https://codeberg.org/takeonrules/emacs.d")))
(should (equal '("foo-bar.github.com" "sshaw/foo/x")
(git-link--parse-remote "https://user:password@foo-bar.github.com/sshaw/foo/x.git")))
(should (equal '("msazure.visualstudio.com" "project/_git/repo")
(git-link--parse-remote "msazure@vs-ssh.visualstudio.com:v3/msazure/project/repo")))
(should (equal '("msazure.visualstudio.com" "DefaultCollection/project/_git/repo")
(git-link--parse-remote "https://msazure.visualstudio.com/DefaultCollection/project/_git/repo")))
(should (equal '("dev.azure.com" "r-darwish/project/_git/repo")
(git-link--parse-remote "git@ssh.dev.azure.com:v3/r-darwish/project/repo")))
(should (equal '("dev.azure.com" "r-darwish/project/_git/repo")
(git-link--parse-remote "https://r-darwish@dev.azure.com/r-darwish/project/_git/repo")))
(should (equal '("git.sv.gnu.org" "emacs")
(git-link--parse-remote "git://git.sv.gnu.org/emacs.git")))
(should (equal '("git.savannah.gnu.org" "emacs")
(git-link--parse-remote "https://git.savannah.gnu.org/git/emacs.git")))
(should (equal '("git.savannah.gnu.org" "emacs")
(git-link--parse-remote "ssh://git.savannah.gnu.org/srv/git/emacs.git")))
(should (equal '("git.savannah.gnu.org" "emacs")
(git-link--parse-remote "git://git.savannah.gnu.org/emacs.git")))
(should (equal '("us-west-2.console.aws.amazon.com" "codesuite/codecommit/repositories/TestRepo")
(git-link--parse-remote "ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/TestRepo")))
(should (equal '("go.googlesource.com" "go")
(git-link--parse-remote "https://go.googlesource.com/go"))))