first versiom
This commit is contained in:
49
regexp_test.go
Normal file
49
regexp_test.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestExp(t *testing.T) {
|
||||
arr := []struct {
|
||||
Url string
|
||||
Match bool
|
||||
}{
|
||||
{
|
||||
Url: "https://github.com/hunshcn/project/archive/master.zip",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://github.com/hunshcn/project/archive/v0.1.0.tar.gz",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://github.com/hunshcn/project/releases/download/v0.1.0/example.zip",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://github.com/hunshcn/project/blob/master/filename",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://github.com/hunshcn/project/blob/1111111111111111111111111111/filename",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile",
|
||||
Match: true,
|
||||
},
|
||||
{
|
||||
Url: "https://baidu.com",
|
||||
Match: false,
|
||||
},
|
||||
{
|
||||
Url: "https://git.aweoo.com/fghwett/notepad.git",
|
||||
Match: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range arr {
|
||||
if v.Match != checkUrl(v.Url) {
|
||||
t.Errorf("%s is not match, except: %t", v.Url, v.Match)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user