MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestEncodeRepoPath

Function TestEncodeRepoPath

internal/session/persist_test.go:23–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21func init() { UseTestSessions() }
22
23func TestEncodeRepoPath(t *testing.T) {
24 tests := []struct {
25 name string
26 input string
27 expected string
28 }{
29 {
30 name: "empty string",
31 input: "",
32 expected: "empty",
33 },
34 {
35 name: "relative path",
36 input: "relative/path/to/repo",
37 expected: "relative-path-to-repo",
38 },
39 {
40 name: "path with mixed separators",
41 input: "path/to\\mixed",
42 expected: "path-to-mixed",
43 },
44 }
45
46 // Add platform-specific test cases
47 if runtime.GOOS == "windows" {
48 tests = append(tests, []struct {
49 name string
50 input string
51 expected string
52 }{
53 {
54 name: "windows drive path",
55 input: "D:\\Users\\admin\\project",
56 expected: "D_Users-admin-project",
57 },
58 {
59 name: "windows C drive",
60 input: "C:\\code\\myapp",
61 expected: "C_code-myapp",
62 },
63 {
64 name: "windows relative path",
65 input: "relative\\path\\to\\repo",
66 expected: "relative-path-to-repo",
67 },
68 {
69 name: "windows drive only",
70 input: "C:",
71 expected: "C_",
72 },
73 {
74 name: "windows drive with separator only",
75 input: "D:\\",
76 expected: "D_",
77 },
78 }...)
79 } else {
80 tests = append(tests, []struct {

Callers

nothing calls this directly

Calls 2

encodeRepoPathFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected