stretchr / testify

A toolkit with common assertions and mocks that plays nicely with the standard library
MIT License
23.14k stars 1.59k forks source link

assert.Regexp: handle []byte array properly #1587

Closed kevinburkesegment closed 4 months ago

kevinburkesegment commented 5 months ago

Summary

The regexp package works more efficiently on bytes; if you have bytes, it is easier to pass these directly to assert.Regexp than to convert them to a string first.

In addition, FindIndex/FindStringIndex are unnecessary here because we immediately throw away the result - let's just call Match() instead.

Motivation

More efficient test calls, fewer casts in test code.

Related issues

Updates #1585.