Skip to content

Commit

Permalink
[+] add test case for double unlock (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub authored Aug 12, 2024
1 parent a3a041d commit c579632
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pgxmock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,3 +1216,16 @@ func TestExpectReset(t *testing.T) {
mock.ExpectReset()
a.Error(mock.ExpectationsWereMet())
}

func TestDoubleUnlock(t *testing.T) {
mock, _ := NewConn()
mock.MatchExpectationsInOrder(false)
a := assert.New(t)

mock.ExpectExec("insert").WillReturnResult(NewResult("ok", 1))
mock.ExpectExec("update").WillReturnResult(NewResult("ok", 1))

_, err := mock.Exec(ctx, "foo")
a.Error(err)
a.NotPanics(func() { _ = mock.Ping(ctx) })
}

0 comments on commit c579632

Please sign in to comment.