(t *testing.T)
| 292 | } |
| 293 | |
| 294 | func TestListStructure_RPOPLPUSH(t *testing.T) { |
| 295 | list, _ := initList() |
| 296 | defer list.db.Clean() |
| 297 | |
| 298 | // Test RPOPLPUSH function when the source list exists |
| 299 | listErr = list.RPush(string(randkv.GetTestKey(1)), randkv.RandomValue(100), 0) |
| 300 | assert.Nil(t, listErr) |
| 301 | listErr = list.RPOPLPUSH(string(randkv.GetTestKey(1)), string(randkv.GetTestKey(2)), 0) |
| 302 | assert.Nil(t, listErr) |
| 303 | |
| 304 | // Test RPOPLPUSH function when the source list does not exist |
| 305 | listErr = list.RPOPLPUSH(string(randkv.GetTestKey(3)), string(randkv.GetTestKey(2)), 0) |
| 306 | assert.Equal(t, listErr, _const.ErrKeyNotFound) |
| 307 | |
| 308 | // Test RPOPLPUSH function when the source list is empty |
| 309 | listErr = list.RPush(string(randkv.GetTestKey(4)), randkv.RandomValue(100), 0) |
| 310 | assert.Nil(t, listErr) |
| 311 | _, listErr = list.RPop(string(randkv.GetTestKey(4))) |
| 312 | assert.Nil(t, listErr) |
| 313 | listErr = list.RPOPLPUSH(string(randkv.GetTestKey(4)), string(randkv.GetTestKey(2)), 0) |
| 314 | assert.Equal(t, listErr, ErrListEmpty) |
| 315 | } |
| 316 | |
| 317 | func TestListStructure_Integration(t *testing.T) { |
| 318 | list, _ := initList() |
nothing calls this directly
no test coverage detected