Skip to content

Commit c579632

Browse files
authored
[+] add test case for double unlock (#217)
1 parent a3a041d commit c579632

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pgxmock_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -1216,3 +1216,16 @@ func TestExpectReset(t *testing.T) {
12161216
mock.ExpectReset()
12171217
a.Error(mock.ExpectationsWereMet())
12181218
}
1219+
1220+
func TestDoubleUnlock(t *testing.T) {
1221+
mock, _ := NewConn()
1222+
mock.MatchExpectationsInOrder(false)
1223+
a := assert.New(t)
1224+
1225+
mock.ExpectExec("insert").WillReturnResult(NewResult("ok", 1))
1226+
mock.ExpectExec("update").WillReturnResult(NewResult("ok", 1))
1227+
1228+
_, err := mock.Exec(ctx, "foo")
1229+
a.Error(err)
1230+
a.NotPanics(func() { _ = mock.Ping(ctx) })
1231+
}

0 commit comments

Comments
 (0)