Skip to content

Commit

Permalink
minimal tests to get started
Browse files Browse the repository at this point in the history
  • Loading branch information
alicebob committed Mar 13, 2024
1 parent 54f5358 commit 53ae736
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd_generic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ func TestTTL(t *testing.T) {
ok(t, err)
defer c.Close()

t.Run("parse", func(t *testing.T) {
t.Run("basic", func(t *testing.T) {
v, err := expireParse("SCAN", []string{"foo", "200"})
ok(t, err)
equals(t, expireOpts{key: "foo", value: 200}, *v)
})
})

// Not volatile yet
{
equals(t, time.Duration(0), s.TTL("foo"))
Expand Down Expand Up @@ -681,6 +689,14 @@ func TestScan(t *testing.T) {
ok(t, err)
defer c.Close()

t.Run("parse", func(t *testing.T) {
t.Run("basic", func(t *testing.T) {
v, err := scanParse("SCAN", []string{"0", "COUNT", "200"})
ok(t, err)
equals(t, scanOpts{count: 200}, *v)
})
})

// We cheat with scan. It always returns everything.

s.Set("key", "value")
Expand Down Expand Up @@ -896,6 +912,14 @@ func TestCopy(t *testing.T) {
ok(t, err)
defer c.Close()

t.Run("parse", func(t *testing.T) {
t.Run("basic", func(t *testing.T) {
v, err := copyParse("copy", []string{"key1", "key2"})
ok(t, err)
equals(t, copyOpts{from: "key1", to: "key2", destinationDB: -1}, *v)
})
})

t.Run("basic", func(t *testing.T) {
s.Set("key1", "value")
// should return 1 after a successful copy operation:
Expand Down

0 comments on commit 53ae736

Please sign in to comment.