testify icon indicating copy to clipboard operation
testify copied to clipboard

feat: add assert.Consistently

Open jfmyers9 opened this issue 8 months ago • 10 comments

Summary

This changeset adds the assert.Consistently and it's associated functions to assert that a condition is true over the entire period of waitFor. This is useful when testing the behavior of asynchronous functions.

Changes

  • assert.Consistently checks that a provided function is true for the entirety of waitFor
  • assert.Consistentlyf checks that a provided function is true for the entirety of waitFor and allows for formatting the error message
  • assert.ConsistentlyWithT checks that a provided function that accepts a testing.T is true for the entirety of waitFor
  • assert.ConsistentlyWithTf checks that a provided function that accepts a testing.T is true for the entirety of waitFor and allows for formatting the error message

Motivation

See: https://github.com/stretchr/testify/issues/1087#issuecomment-2139222285

Related issues

Closes https://github.com/stretchr/testify/issues/1087

jfmyers9 avatar Jun 04 '24 05:06 jfmyers9