MCPcopy Index your code
hub / github.com/cli/cli / Test_SanitizeFileName

Function Test_SanitizeFileName

pkg/cmd/release/upload/upload_test.go:9–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_SanitizeFileName(t *testing.T) {
10 tests := []struct {
11 name string
12 expected string
13 }{
14 {
15 name: "foo",
16 expected: "foo",
17 },
18 {
19 name: "foo bar",
20 expected: "foo.bar",
21 },
22 {
23 name: ".foo",
24 expected: "default.foo",
25 },
26 {
27 name: "Foo bar",
28 expected: "Foo.bar",
29 },
30 {
31 name: "Hello, दुनिया",
32 expected: "default.Hello",
33 },
34 {
35 name: "this+has+plusses.jpg",
36 expected: "this+has+plusses.jpg",
37 },
38 {
39 name: "this@has@at@signs.jpg",
40 expected: "this@has@at@signs.jpg",
41 },
42 {
43 name: "façade.exposé",
44 expected: "facade.expose",
45 },
46 }
47 for _, tt := range tests {
48 t.Run(tt.name, func(t *testing.T) {
49 assert.Equal(t, tt.expected, sanitizeFileName(tt.name))
50 })
51 }
52}

Callers

nothing calls this directly

Calls 3

sanitizeFileNameFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected