Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test cases for dash and update doc #42

Merged
merged 2 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ in `setup()` function.

## Configuration

```lua
````lua
require('gitlinker').setup({
-- print message in command line
message = true,
Expand All @@ -116,16 +116,16 @@ require('gitlinker').setup({
-- regex pattern based rules
pattern_rules = {
{
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/",
},
{
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/",
["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/",
},
},

Expand Down Expand Up @@ -171,4 +171,4 @@ require('gitlinker').setup({
-- write logs to file
file_log = false,
})
```
````
10 changes: 10 additions & 0 deletions lua/gitlinker/test/test_rules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ local test_cases = {
"https://gitlab.com/ruifm/gitlinker.nvim",
"https://gitlab.com/ruifm/gitlinker.nvim/blob/",
},
-- [13]
{
"git@github.enterprise.io: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
Expand Down