HouzuoGuo / tiedot

A rudimentary implementation of a basic document (NoSQL) database in Go
BSD 2-Clause "Simplified" License
2.72k stars 258 forks source link

httpapi: suspicious condition in srv_test.go #164

Open quasilyte opened 5 years ago

quasilyte commented 5 years ago

https://github.com/HouzuoGuo/tiedot/blob/791033267fb3d7b02f0465a2527e8048485ee506/httpapi/srv_test.go#L131

Looks like there is a mistake inside 3 recovers inside that file. If r is nil, it can't match sprintf result, so there is something wrong here. I would guess that && should be changed to ||, but r == fmt.Sprintf(...) also look incorrect. Anyway, I don't have any context, it looks like it tries to test that panic is caught and that the value returned by recover match the expected one. Code inside tests doesn't do that in a clear way. right now.