Skip to content

Commit

Permalink
Added simple error check test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Oct 3, 2020
1 parent c054dd7 commit 2e11f00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions redis_lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,20 @@ func TestReleaseLock(t *testing.T) {
t.Fatalf("expected release lock to succeed, got unlocked %t error %q", unlocked, err)
}
}

// TestWriteLockError will run basic error test for WriteLock()
func TestWriteLockError(t *testing.T) {
// Create a local connection
if err := startTest(); err != nil {
t.Fatal(err.Error())
}

// Disconnect at end
defer endTest()

// Test error case
_, err := WriteLock("d `!$-()my-key", "d d d", int64(0))
if err == nil {
t.Fatalf("expected error to occur")
}
}

0 comments on commit 2e11f00

Please sign in to comment.