1 Star 0 Fork 0

CNCF/devstatscode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
regexp_test.go 19.67 KB
一键复制 编辑 原始数据 按行查看 历史
Lukasz Gryglicki 提交于 2025-03-07 15:28 +08:00 . Added test cases
package devstatscode
import (
"regexp"
"testing"
)
func TestAnnotationRegexp(t *testing.T) {
// Test cases
var testCases = []struct {
re string
str string
match bool
}{
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.0", match: true},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.0-rc.1", match: true},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.0-beta.1.dev.20221204", match: false},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.0-alpha.4", match: true},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.0-beta.4", match: true},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.1-rc.1", match: false},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.2", match: false},
{re: `^v\d+\.\d+\.0(-(alpha|beta|rc)\.\d+)?$`, str: "v1.0.3-rc.1", match: false},
{re: `^(v\d+\.\d+\.\d+|release-\d{4}-\d{2}-\d{2})$`, str: "v1.2.3", match: true},
{re: `^(v\d+\.\d+\.\d+|release-\d{4}-\d{2}-\d{2})$`, str: "v1.2", match: false},
{re: `^(v\d+\.\d+\.\d+|release-\d{4}-\d{2}-\d{2})$`, str: "v1.2.3.4", match: false},
{re: `^(v\d+\.\d+\.\d+|release-\d{4}-\d{2}-\d{2})$`, str: "release-2021-05-15", match: true},
{re: `^(v\d+\.\d+\.\d+|release-\d{4}-\d{2}-\d{2})$`, str: "release-201-05-15", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v0.0", match: true},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v1.0", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "0.0", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: " v0.0 ", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v1.0.0", match: true},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v1.15.0", match: true},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v0.0.0", match: true},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "v1.2.3", match: false},
{re: `^v((0\.\d+)|(\d+\.\d+\.0))$`, str: "V1.4.9", match: false},
{re: `^v?\d+\.\d+\.0$`, str: "v0.0.0", match: true},
{re: `^v?\d+\.\d+\.0$`, str: "v1.0.0", match: true},
{re: `^v?\d+\.\d+\.0$`, str: "0.12.0", match: true},
{re: `^v(\d+\.){1,2}\d+$`, str: "v1.1", match: true},
{re: `^v(\d+\.){1,2}\d+$`, str: "v2.3.4", match: true},
{re: `^v(\d+\.){1,2}\d+$`, str: "v1.2.3.4", match: false},
{re: `^(release-\d+\.\d+\.\d+|\d+\.\d+\.0)$`, str: "release-0.1.2", match: true},
{re: `^(release-\d+\.\d+\.\d+|\d+\.\d+\.0)$`, str: "1.2.0", match: true},
{re: `^(release-\d+\.\d+\.\d+|\d+\.\d+\.0)$`, str: "release-0.1", match: false},
{re: `^(release-\d+\.\d+\.\d+|\d+\.\d+\.0)$`, str: "2.3.4", match: false},
{re: `^jenkins-\d+\.\d+$`, str: "2.3.4", match: false},
{re: `^jenkins-\d+\.\d+$`, str: "jenkins-2", match: false},
{re: `^jenkins-\d+\.\d+$`, str: "jenkins-2.1", match: true},
{re: `^jenkins-\d+\.\d+$`, str: "jenkins-2.1.1", match: false},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "1.2.3", match: false},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "v0.1.2", match: true},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "v000", match: true},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "007", match: false},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "v007", match: true},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "v0000", match: false},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "05", match: false},
{re: `^v(\d+\.\d+\.\d+|\d\d\d)$`, str: "v0.2", match: false},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "1.2.3", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.12.23", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-", match: false},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-a", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-.", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1--", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-+", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-0", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "1.0.1-rc.1", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-alpha", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "1.0.1-beta2", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-rc.3", match: true},
{re: `^v?\d+\.\d+\.\d+(-[\w-+\d.]+)?$`, str: "v1.0.1-al b", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.0", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.10", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.05", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.5", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.50", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.49", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.51", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.55", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.11", match: false},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.0.100", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v1.3.150", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v3.0.200", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v0.5.500", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v10.10.550", match: true},
{re: `^v\d+\.\d+\.(0|\d*[05]0)$`, str: "v10.10.520", match: false},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.10.0", match: true},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.11.10", match: true},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.12.100", match: true},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.13.101", match: false},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.14.11", match: false},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.15.1", match: false},
{re: `^v\d+\.\d+\.(0|\d+0)$`, str: "v10.15", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.0", match: true},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.10", match: true},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.205", match: true},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.201", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.204", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.04", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.24", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.4", match: false},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.200", match: true},
{re: `^v\d+\.\d+\.\d*[05]$`, str: "v10.15.15", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "vendor/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_vendor/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/vendor/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/vendor/a", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "vendor//", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_vendor/abc/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/vendor/ abc", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "vendor", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "vendor_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/vendor", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/vendor", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/vendor_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/vendor_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "Godeps/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_Godeps/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/Godeps/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/Godeps/a", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "Godeps//", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_Godeps/abc/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/Godeps/ abc", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "Godeps", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "Godeps_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/Godeps", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/Godeps", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/Godeps_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/Godeps_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "workspace/", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_workspace/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "__workspace/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/workspace/", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/_workspace/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/__workspace/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/workspace/a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/_workspace/a", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/__workspace/a", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "workspace//", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_workspace/abc/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "__workspace/abc/", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/workspace/ abc", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/_workspace/ abc", match: true},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "workspace_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "_workspace_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/_workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/_workspace", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/workspace_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "/_workspace_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/workspace_a", match: false},
{re: `(^|/)_?(vendor|Godeps|_workspace)/`, str: "abc/_workspace_a", match: false},
{re: `(?i)^(plexistor|stack\s*point\s*cloud|greenqloud|netapp)(,?\s*inc\.?)?$`, str: "GreenQLoud, Inc.", match: true},
{re: `^\d+\.(0|\d+0)$`, str: "0.0", match: true},
{re: `^\d+\.(0|\d+0)$`, str: "0.10", match: true},
{re: `^\d+\.(0|\d+0)$`, str: "1.220", match: true},
{re: `^\d+\.(0|\d+0)$`, str: "2.00", match: true},
{re: `^\d+\.(0|\d+0)$`, str: "2.11", match: false},
{re: `^\d+\.(0|\d+0)$`, str: "0.73", match: false},
{re: `^\d+\.(0|\d+0)$`, str: "0.a0", match: false},
{re: `^\d+\.(0|\d+0)$`, str: "2.10.0", match: false},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v0.0.0", match: true},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v0.0.1", match: false},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v0.0.10", match: true},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v0.0.12", match: false},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v1.16.10+k3s1", match: true},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v1.16.10-k3s1", match: false},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v1.16.11+k3s1", match: false},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v1.12.0+k3s.1", match: true},
{re: `^v\d+\.\d+\.\d*0(\+k3s\.?1)?$`, str: "v1.12.0+k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "ibuildthecloud/k3s", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "IBuildTheCloud/K3s", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "buildthecloud/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "iibuildthecloud/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "iibuildtheclouds/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "ibuildtheclouds/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "rancher/k3s", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "ancher/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "xrancher/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "rancher-lab/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "a-rancher-org/k3s", match: false},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "Rancher/K3s", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "rancher/k3D", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "Rancher/myk3s", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "Rancher/k3docker", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "IBuildTheCloud/new-K3S-v.2", match: true},
{re: `(?i)^((ibuildthecloud|rancher)\/.*k3(s|d).*|k3s-io\/.*)$`, str: "Rancher/myk3s", match: true},
{re: `(?i)^((ibuildthecloud|rancher)\/.*k3(s|d).*|k3s-io\/.*)$`, str: "k3s-io/k3s", match: true},
{re: `(?i)^((ibuildthecloud|rancher)\/.*k3(s|d).*|k3s-io\/.*)$`, str: "k3s-io/whatever", match: true},
{re: `(?i)^(ibuildthecloud|rancher)\/.*k3(s|d).*$`, str: "k3s-io/whatever", match: false},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.0", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.1", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "1.0", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "1.2", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "2.3.0", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.0.0", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.15.0", match: true},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2", match: false},
{re: `^v?\d+\.\d+(\.0)?$`, str: "20", match: false},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.0.1", match: false},
{re: `^v?\d+\.\d+(\.0)?$`, str: "2.3.5", match: false},
{re: `^v?\d+\.\d+(\.0)?$`, str: "v2.0.0.0", match: false},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v3.0.0", match: true},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v2.1.0", match: true},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v2.1.0-xyz", match: false},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v2.1", match: false},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v1alpha1", match: true},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v1.0", match: true},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v1.0.0", match: true},
{re: `^v(\d+\.\d+\.\d+$|1)`, str: "v1.0.0.0", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "AppDynamics LLC", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "Appdynamics LLC", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "appDynamics\tLLC", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "AppDynamics (Cisco)", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "appdynamics (cisco)", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "Epsagon", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "Epsagon LLC", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "BanzaiCloud", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "Banzai Cloud", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "Banzai Cloud Zrt", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "banzai cloud\tzrt", match: true},
{re: `(?i)^(appdynamics(\s+(llc|\(cisco\)))?|epsagon(\s+(llc))?|banzai\s*?cloud(\s+zrt)?)$`, str: "banzaicloudzrt", match: false},
{re: `^(knative-)?v\d+\.\d+\.0$`, str: "knative-v1.1.4", match: false},
{re: `^(knative-)?v\d+\.\d+\.0$`, str: "v1.1.0", match: true},
{re: `^(knative-)?v\d+\.\d+\.0$`, str: "v1.1.4", match: false},
{re: `^(knative-)?v\d+\.\d+\.0$`, str: "knative-v1.1.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.0.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.0.1", match: false},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.5.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.10.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.15.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.10.1", match: false},
{re: `^v\d+\.\d*[05]\.0$`, str: "v10.225.0", match: true},
{re: `^v\d+\.\d*[05]\.0$`, str: "v0.5", match: false},
{re: `^v\d+\.\d*[05]\.0$`, str: "0.15.0", match: false},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: "ms-general-1.2.0", match: true},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: "ms-general-0.2.10", match: true},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: "ms-general-1.0.11", match: false},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: "ms-general-2.4.1", match: false},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: "ms-general-0.0.200", match: true},
{re: `^ms-general-\d+\.\d+\.\d*0$`, str: " ms-general-1.1.10 ", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "8.1.1", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "8.1.0", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "8.0.1", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "8.0.0", match: true},
{re: `^\d+\.0\.0(\.Final)?$`, str: "7.0.0.final", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "7.0.0.Final", match: true},
{re: `^\d+\.0\.0(\.Final)?$`, str: "7.0.0.Finally", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "7.0.1.Final", match: false},
{re: `^\d+\.0\.0(\.Final)?$`, str: "7.1.0.Final", match: false},
{re: `^v\d+\.\d+\.0$`, str: "v1.2.3", match: false},
{re: `^v\d+\.\d+\.0$`, str: "v1.2.0", match: true},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.2.0", match: true},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.2.1", match: false},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.0.0-beta.0", match: true},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.0.0-beta.10", match: true},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.0.0-beta.1", match: false},
{re: `^v\d+\.\d+\.0(-beta\.\d*0)?$`, str: "v1.0.0-beta.101", match: false},
{re: `^v\d+\.\d+\.\d*0$`, str: "v1.2.0", match: true},
{re: `^v\d+\.\d+\.\d*0$`, str: "v1.2.10", match: true},
{re: `^v\d+\.\d+\.\d*0$`, str: "v1.2.110", match: true},
{re: `^v\d+\.\d+\.\d*0$`, str: "v1.2.1", match: false},
{re: `^v\d+\.\d+\.0\+k0s\.\d+$`, str: "v1.2.0+k0s.0", match: true},
{re: `^v\d+\.\d+\.0\+k0s\.\d+$`, str: "v1.2.0-beta.+k0s.0", match: false},
{re: `^v\d+\.\d+\.0\+k0s\.\d+$`, str: "v1.2.0+k0s.1", match: true},
{re: `(?i)^interTwin-eu\/(.*interlink.*|vk-test-set)$`, str: "interTwin-eu/interLink", match: true},
{re: `(?i)^interTwin-eu\/(.*interlink.*|vk-test-set)$`, str: "intertwin-eu/interlink", match: true},
{re: `(?i)^intertwin-eu\/(.*interlink.*|vk-test-set)$`, str: "interTwin-eu/interLink", match: true},
{re: `(?i)^interTwin-eu\/(.*interlink.*|vk-test-set)$`, str: "interTwin-eu/vk-test-set", match: true},
}
// Execute test cases
for index, test := range testCases {
expected := test.match
re := regexp.MustCompile(test.re)
got := re.MatchString(test.str)
if got != expected {
t.Errorf(
"test number %d, expected match result '%v' for string '%v' matching regexp '%v', got '%v'",
index+1, expected, test.str, re, got,
)
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cncf/devstatscode.git
git@gitee.com:cncf/devstatscode.git
cncf
devstatscode
devstatscode
master

搜索帮助