(t *testing.T)
| 161 | } |
| 162 | |
| 163 | func TestIsSessionKey(t *testing.T) { |
| 164 | tests := []struct { |
| 165 | key string |
| 166 | expected bool |
| 167 | }{ |
| 168 | {"session:state1", true}, |
| 169 | {"session:", false}, // 长度不够 |
| 170 | {"app:setting1", false}, |
| 171 | {"user:setting1", false}, |
| 172 | {"temp:setting1", false}, |
| 173 | {"state1", false}, |
| 174 | } |
| 175 | |
| 176 | for _, tt := range tests { |
| 177 | t.Run(tt.key, func(t *testing.T) { |
| 178 | result := IsSessionKey(tt.key) |
| 179 | if result != tt.expected { |
| 180 | t.Errorf("IsSessionKey(%q) = %v, expected %v", tt.key, result, tt.expected) |
| 181 | } |
| 182 | }) |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | func TestGenerateEventID(t *testing.T) { |
| 187 | id1 := generateEventID() |
nothing calls this directly
no test coverage detected