Skip to content

Commit

Permalink
ci: format
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Oct 8, 2023
1 parent dfddc22 commit dbd0c97
Showing 1 changed file with 80 additions and 80 deletions.
160 changes: 80 additions & 80 deletions lua/gitlinker/test/test_rules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,90 +6,90 @@ local map_remote_to_host = require("gitlinker").map_remote_to_host
-- input data: `git remote get-url origin/upstream/etc`
-- expected output data: git link url
local test_cases = {
-- [1]
{
"[email protected]:linrongbin16/gitlinker.nvim.git",
"https://github.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [2]
{
"[email protected]:linrongbin16/gitlinker.nvim",
"https://github.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [3]
{
"https://github.com/ruifm/gitlinker.nvim.git",
"https://github.com/ruifm/gitlinker.nvim/blob/",
},
-- [4]
{
"https://github.com/ruifm/gitlinker.nvim",
"https://github.com/ruifm/gitlinker.nvim/blob/",
},
-- [5]
{
"[email protected]:organization/repository.git",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [6]
{
"[email protected]:organization/repository",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [7]
{
"https://github.enterprise.io/organization/repository.git",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [8]
{
"https://github.enterprise.io/organization/repository",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [9]
{
"[email protected]:linrongbin16/gitlinker.nvim.git",
"https://gitlab.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [10]
{
"[email protected]:linrongbin16/gitlinker.nvim",
"https://gitlab.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [11]
{
"https://gitlab.com/ruifm/gitlinker.nvim.git",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [12]
{
"https://gitlab.com/ruifm/gitlinker.nvim",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [13]
{
"[email protected]:organization/repository_with_single_dash1",
"https://github.enterprise.io/organization/repository_with_single_dash1/blob/",
},
-- [14]
{
"https://github.enterprise.io/organization/repository____multiple___dash2.git",
"https://github.enterprise.io/organization/repository____multiple___dash2/blob/",
},
-- [1]
{
"[email protected]:linrongbin16/gitlinker.nvim.git",
"https://github.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [2]
{
"[email protected]:linrongbin16/gitlinker.nvim",
"https://github.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [3]
{
"https://github.com/ruifm/gitlinker.nvim.git",
"https://github.com/ruifm/gitlinker.nvim/blob/",
},
-- [4]
{
"https://github.com/ruifm/gitlinker.nvim",
"https://github.com/ruifm/gitlinker.nvim/blob/",
},
-- [5]
{
"[email protected]:organization/repository.git",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [6]
{
"[email protected]:organization/repository",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [7]
{
"https://github.enterprise.io/organization/repository.git",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [8]
{
"https://github.enterprise.io/organization/repository",
"https://github.enterprise.io/organization/repository/blob/",
},
-- [9]
{
"[email protected]:linrongbin16/gitlinker.nvim.git",
"https://gitlab.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [10]
{
"[email protected]:linrongbin16/gitlinker.nvim",
"https://gitlab.com/linrongbin16/gitlinker.nvim/blob/",
},
-- [11]
{
"https://gitlab.com/ruifm/gitlinker.nvim.git",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [12]
{
"https://gitlab.com/ruifm/gitlinker.nvim",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [13]
{
"[email protected]:organization/repository_with_single_dash1",
"https://github.enterprise.io/organization/repository_with_single_dash1/blob/",
},
-- [14]
{
"https://github.enterprise.io/organization/repository____multiple___dash2.git",
"https://github.enterprise.io/organization/repository____multiple___dash2/blob/",
},
}

for i, case in ipairs(test_cases) do
local actual = map_remote_to_host(case[1])
local expect = case[2]
assert(
actual == expect,
string.format(
"Failed test case [%d] - actual: `%s` != expect: `%s`",
i,
tostring(actual),
tostring(expect)
local actual = map_remote_to_host(case[1])
local expect = case[2]
assert(
actual == expect,
string.format(
"Failed test case [%d] - actual: `%s` != expect: `%s`",
i,
tostring(actual),
tostring(expect)
)
)
)
end

print("all test cases succeeded!")

0 comments on commit dbd0c97

Please sign in to comment.