fix: Update unix-like path regex (#1637)
* Revert import value regex * Update linux path regex Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
versionRegex = `(?m)"v[1-9][0-9]*"`
|
versionRegex = `(?m)"v[1-9][0-9]*"`
|
||||||
importValueRegex = `(?m)"\/?(([a-zA-Z0-9.]+)+(\/?){1})+([a-zA-Z0-9]+)+\.api"`
|
importValueRegex = `(?m)"\/?(?:[^/]+\/)*[^/]+.api"`
|
||||||
tagRegex = `(?m)\x60[a-z]+:".+"\x60`
|
tagRegex = `(?m)\x60[a-z]+:".+"\x60`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ func TestImportRegex(t *testing.T) {
|
|||||||
|
|
||||||
{`"bar..api"`, false},
|
{`"bar..api"`, false},
|
||||||
{`"//bar.api"`, false},
|
{`"//bar.api"`, false},
|
||||||
|
{`"/foo/foo_bar.api"`, true},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.value, func(t *testing.T) {
|
t.Run(tt.value, func(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user