@@ -221,6 +221,36 @@ function test_failure() {
221221` ` `
222222:::
223223
224+ # # assert_string_matches_format
225+ > ` assert_string_matches_format " format" " value" `
226+
227+ Reports an error if ` value` does not match the ` format` string. The format string uses PHPUnit-style placeholders:
228+
229+ | Placeholder | Matches |
230+ | -------------| ---------|
231+ | ` %d` | One or more digits |
232+ | ` %i` | Signed integer (e.g. ` +1` , ` -42` ) |
233+ | ` %f` | Floating point number (e.g. ` 3.14` ) |
234+ | ` %s` | One or more non-whitespace characters |
235+ | ` %x` | Hexadecimal (e.g. ` ff00ab` ) |
236+ | ` %e` | Scientific notation (e.g. ` 1.5e10` ) |
237+ | ` %%` | Literal ` %` character |
238+
239+ - [assert_string_not_matches_format](# assert-string-not-matches-format) is the inverse of this assertion and takes the same arguments.
240+
241+ ::: code-group
242+ ` ` ` bash [Example]
243+ function test_success() {
244+ assert_string_matches_format " %d items found" " 42 items found"
245+ assert_string_matches_format " %s has %d items at %f each" " cart has 5 items at 9.99 each"
246+ }
247+
248+ function test_failure() {
249+ assert_string_matches_format " %d items" " hello world"
250+ }
251+ ` ` `
252+ :::
253+
224254# # assert_line_count
225255> ` assert_line_count " count" " haystack" `
226256
@@ -957,6 +987,25 @@ function test_failure() {
957987```
958988:::
959989
990+ ## assert_string_not_matches_format
991+ > `assert_string_not_matches_format "format" "value"`
992+
993+ Reports an error if `value` matches the `format` string. See [assert_string_matches_format](#assert-string-matches-format) for supported placeholders.
994+
995+ - [assert_string_matches_format](#assert-string-matches-format) is the inverse of this assertion and takes the same arguments.
996+
997+ ::: code-group
998+ ```bash [Example]
999+ function test_success() {
1000+ assert_string_not_matches_format "%d items" "hello world"
1001+ }
1002+
1003+ function test_failure() {
1004+ assert_string_not_matches_format "%d items" "42 items"
1005+ }
1006+ ```
1007+ :::
1008+
9601009## assert_array_not_contains
9611010> `assert_array_not_contains "needle" "haystack"`
9621011
0 commit comments