summaryrefslogtreecommitdiff
path: root/tests/modules/devel/git/test.lua
blob: 0fbae4b1e77901781a353bc35fa59f6c80eacb19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import("devel.git")


function test_asgiturl(t)
    t:are_equal(git.asgiturl("http://github.com/a/b"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("http://github.com/a/b/"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("HTTP://github.com//a/b/"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("http://github.com//a/b/s"), nil)
    t:are_equal(git.asgiturl("https://github.com/a/b"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("https://github.com/a/b.git"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("HTTPS://GITHUB.com/a/b.git.git"), "https://github.com/a/b.git.git")

    t:are_equal(git.asgiturl("github:a/b"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("github:a/b.git"), "https://github.com/a/b.git.git")
    t:are_equal(git.asgiturl("GitHub://a/b/"), "https://github.com/a/b.git")
    t:are_equal(git.asgiturl("github:a/b/c"), nil)
end