MCPcopy
hub / github.com/cli/cli / TestNormalizeRepoName

Function TestNormalizeRepoName

pkg/cmd/repo/shared/repo_test.go:7–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func TestNormalizeRepoName(t *testing.T) {
8 // confirmed using GitHub.com/new
9 tests := []struct {
10 LocalName string
11 NormalizedName string
12 }{
13 {
14 LocalName: "cli",
15 NormalizedName: "cli",
16 },
17 {
18 LocalName: "cli.git",
19 NormalizedName: "cli",
20 },
21 {
22 LocalName: "@-#$^",
23 NormalizedName: "---",
24 },
25 {
26 LocalName: "[cli]",
27 NormalizedName: "-cli-",
28 },
29 {
30 LocalName: "Hello World, I'm a new repo!",
31 NormalizedName: "Hello-World-I-m-a-new-repo-",
32 },
33 {
34 LocalName: " @E3H*(#$#_$-ZVp,n.7lGq*_eMa-(-zAZSJYg!",
35 NormalizedName: "-E3H-_--ZVp-n.7lGq-_eMa---zAZSJYg-",
36 },
37 {
38 LocalName: "I'm a crazy .git repo name .git.git .git",
39 NormalizedName: "I-m-a-crazy-.git-repo-name-.git.git-",
40 },
41 }
42 for _, tt := range tests {
43 output := NormalizeRepoName(tt.LocalName)
44 if output != tt.NormalizedName {
45 t.Errorf("Expected %q, got %q", tt.NormalizedName, output)
46 }
47 }
48}

Callers

nothing calls this directly

Calls 2

NormalizeRepoNameFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected