MCPcopy Create free account
hub / github.com/astercloud/aster / TestIsUserKey

Function TestIsUserKey

pkg/session/session_test.go:117–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestIsUserKey(t *testing.T) {
118 tests := []struct {
119 key string
120 expected bool
121 }{
122 {"user:preference1", true},
123 {"user:", false}, // 长度不够
124 {"app:setting1", false},
125 {"temp:setting1", false},
126 {"session:setting1", false},
127 {"preference1", false},
128 }
129
130 for _, tt := range tests {
131 t.Run(tt.key, func(t *testing.T) {
132 result := IsUserKey(tt.key)
133 if result != tt.expected {
134 t.Errorf("IsUserKey(%q) = %v, expected %v", tt.key, result, tt.expected)
135 }
136 })
137 }
138}
139
140func TestIsTempKey(t *testing.T) {
141 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsUserKeyFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected