MCPcopy
hub / github.com/google/gvisor / TestParseIssueNo

Function TestParseIssueNo

tools/github/reviver/github_test.go:21–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestParseIssueNo(t *testing.T) {
22 testCases := []struct {
23 issue string
24 expectErr bool
25 expected int
26 }{
27 {
28 issue: "gvisor.dev/issue/123",
29 expected: 123,
30 },
31 {
32 issue: "gvisor.dev/issue/123/",
33 expected: 123,
34 },
35 {
36 issue: "not a url",
37 expected: 0,
38 },
39 {
40 issue: "gvisor.dev/issue//",
41 expectErr: true,
42 },
43 }
44
45 for _, tc := range testCases {
46 t.Run(tc.issue, func(t *testing.T) {
47 id, err := parseIssueNo(tc.issue)
48 if err != nil && !tc.expectErr {
49 t.Errorf("got error: %v", err)
50 } else if tc.expected != id {
51 t.Errorf("got: %v, want: %v", id, tc.expected)
52 }
53 })
54 }
55}

Callers

nothing calls this directly

Calls 3

parseIssueNoFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…