Add helper Matcher for logging the rooms section

Useful for debugging a test.
This commit is contained in:
David Robertson 2023-07-18 10:39:34 +01:00
parent 4eb9bcc27f
commit 64183a3b99
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -644,6 +644,15 @@ func LogResponse(t *testing.T) RespMatcher {
}
}
// LogRooms is like LogResponse, but only logs the rooms section of the response.
func LogRooms(t *testing.T) RespMatcher {
return func(res *sync3.Response) error {
dump, _ := json.MarshalIndent(res.Rooms, "", " ")
t.Logf("Response rooms were: %s", dump)
return nil
}
}
func CheckList(listKey string, res sync3.ResponseList, matchers ...ListMatcher) error {
for _, m := range matchers {
if err := m(res); err != nil {