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

Function TestIsTempKey

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

Source from the content-addressed store, hash-verified

138}
139
140func TestIsTempKey(t *testing.T) {
141 tests := []struct {
142 key string
143 expected bool
144 }{
145 {"temp:data1", true},
146 {"temp:", false}, // 长度不够
147 {"app:setting1", false},
148 {"user:setting1", false},
149 {"session:setting1", false},
150 {"data1", false},
151 }
152
153 for _, tt := range tests {
154 t.Run(tt.key, func(t *testing.T) {
155 result := IsTempKey(tt.key)
156 if result != tt.expected {
157 t.Errorf("IsTempKey(%q) = %v, expected %v", tt.key, result, tt.expected)
158 }
159 })
160 }
161}
162
163func TestIsSessionKey(t *testing.T) {
164 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsTempKeyFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected