diff --git a/assert/assert_adhoc_example_5_test.go b/assert/assert_adhoc_example_5_test.go index e93bd1a64..b64ab89a2 100644 --- a/assert/assert_adhoc_example_5_test.go +++ b/assert/assert_adhoc_example_5_test.go @@ -26,7 +26,7 @@ func ExamplePanicAssertionFunc() { type panicAssertionCase struct { name string - panicFn assert.PanicTestFunc + panicFn func() assertion assert.PanicAssertionFunc } diff --git a/assert/assert_assertions.go b/assert/assert_assertions.go index c9a87f40b..dc9f45d70 100644 --- a/assert/assert_assertions.go +++ b/assert/assert_assertions.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert @@ -1423,7 +1423,7 @@ func Kind(t T, expectedKind reflect.Kind, object any, msgAndArgs ...any) bool { // // Len also fails if the object has a type that len() does not accept. // -// The asserted object can be a string, a slice, a map, an array or a channel. +// The asserted object can be a string, a slice, a map, an array, pointer to array or a channel. // // See also [reflect.Len]. // @@ -1964,7 +1964,7 @@ func NotNil(t T, object any, msgAndArgs ...any) bool { return assertions.NotNil(t, object, msgAndArgs...) } -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// NotPanics asserts that the code inside the specified function does NOT panic. // // # Usage // @@ -1976,7 +1976,7 @@ func NotNil(t T, object any, msgAndArgs ...any) bool { // failure: func() { panic("panicking") } // // Upon failure, the test [T] is marked as failed and continues execution. -func NotPanics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func NotPanics(t T, f func(), msgAndArgs ...any) bool { if h, ok := t.(H); ok { h.Helper() } @@ -2136,7 +2136,7 @@ func NotZero(t T, i any, msgAndArgs ...any) bool { return assertions.NotZero(t, i, msgAndArgs...) } -// Panics asserts that the code inside the specified PanicTestFunc panics. +// Panics asserts that the code inside the specified function panics. // // # Usage // @@ -2148,16 +2148,15 @@ func NotZero(t T, i any, msgAndArgs ...any) bool { // failure: func() { } // // Upon failure, the test [T] is marked as failed and continues execution. -func Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func Panics(t T, f func(), msgAndArgs ...any) bool { if h, ok := t.(H); ok { h.Helper() } return assertions.Panics(t, f, msgAndArgs...) } -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. +// PanicsWithError asserts that the code inside the specified function panics, +// and that the recovered panic value is an error that satisfies the EqualError comparison. // // # Usage // @@ -2169,15 +2168,15 @@ func Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool { // failure: ErrTest.Error(), func() { } // // Upon failure, the test [T] is marked as failed and continues execution. -func PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) bool { if h, ok := t.(H); ok { h.Helper() } return assertions.PanicsWithError(t, errString, f, msgAndArgs...) } -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. +// PanicsWithValue asserts that the code inside the specified function panics, +// and that the recovered panic value equals the expected panic value. // // # Usage // @@ -2189,7 +2188,7 @@ func PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndAr // failure: "panicking", func() { } // // Upon failure, the test [T] is marked as failed and continues execution. -func PanicsWithValue(t T, expected any, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) bool { if h, ok := t.(H); ok { h.Helper() } @@ -2510,6 +2509,8 @@ func StringNotContainsT[ADoc, EDoc Text](t T, str ADoc, substring EDoc, msgAndAr // Map elements are key-value pairs unless compared with an array or slice where // only the map key is evaluated. // +// nil values are considered as empty sets. +// // # Usage // // assertions.Subset(t, []int{1, 2, 3}, []int{1, 2}) diff --git a/assert/assert_assertions_test.go b/assert/assert_assertions_test.go index 602246d65..454a6a35f 100644 --- a/assert/assert_assertions_test.go +++ b/assert/assert_assertions_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert diff --git a/assert/assert_examples_test.go b/assert/assert_examples_test.go index c6b4b9c30..3c592e9ef 100644 --- a/assert/assert_examples_test.go +++ b/assert/assert_examples_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert_test diff --git a/assert/assert_format.go b/assert/assert_format.go index e653eb4e2..0685172de 100644 --- a/assert/assert_format.go +++ b/assert/assert_format.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert @@ -869,7 +869,7 @@ func NotNilf(t T, object any, msg string, args ...any) bool { // NotPanicsf is the same as [NotPanics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func NotPanicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool { +func NotPanicsf(t T, f func(), msg string, args ...any) bool { if h, ok := t.(H); ok { h.Helper() } @@ -949,7 +949,7 @@ func NotZerof(t T, i any, msg string, args ...any) bool { // Panicsf is the same as [Panics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool { +func Panicsf(t T, f func(), msg string, args ...any) bool { if h, ok := t.(H); ok { h.Helper() } @@ -959,7 +959,7 @@ func Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool { // PanicsWithErrorf is the same as [PanicsWithError], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg string, args ...any) bool { +func PanicsWithErrorf(t T, errString string, f func(), msg string, args ...any) bool { if h, ok := t.(H); ok { h.Helper() } @@ -969,7 +969,7 @@ func PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg str // PanicsWithValuef is the same as [PanicsWithValue], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func PanicsWithValuef(t T, expected any, f assertions.PanicTestFunc, msg string, args ...any) bool { +func PanicsWithValuef(t T, expected any, f func(), msg string, args ...any) bool { if h, ok := t.(H); ok { h.Helper() } diff --git a/assert/assert_format_test.go b/assert/assert_format_test.go index d7508b94c..e0f979de6 100644 --- a/assert/assert_format_test.go +++ b/assert/assert_format_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert diff --git a/assert/assert_forward.go b/assert/assert_forward.go index f8727e04f..1f1ef7eeb 100644 --- a/assert/assert_forward.go +++ b/assert/assert_forward.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert @@ -1314,7 +1314,7 @@ func (a *Assertions) NotNilf(object any, msg string, args ...any) bool { // NotPanics is the same as [NotPanics], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) NotPanics(f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func (a *Assertions) NotPanics(f func(), msgAndArgs ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1324,7 +1324,7 @@ func (a *Assertions) NotPanics(f assertions.PanicTestFunc, msgAndArgs ...any) bo // NotPanicsf is the same as [Assertions.NotPanics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) NotPanicsf(f assertions.PanicTestFunc, msg string, args ...any) bool { +func (a *Assertions) NotPanicsf(f func(), msg string, args ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1414,7 +1414,7 @@ func (a *Assertions) NotZerof(i any, msg string, args ...any) bool { // Panics is the same as [Panics], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) Panics(f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func (a *Assertions) Panics(f func(), msgAndArgs ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1424,7 +1424,7 @@ func (a *Assertions) Panics(f assertions.PanicTestFunc, msgAndArgs ...any) bool // Panicsf is the same as [Assertions.Panics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) Panicsf(f assertions.PanicTestFunc, msg string, args ...any) bool { +func (a *Assertions) Panicsf(f func(), msg string, args ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1434,7 +1434,7 @@ func (a *Assertions) Panicsf(f assertions.PanicTestFunc, msg string, args ...any // PanicsWithError is the same as [PanicsWithError], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) PanicsWithError(errString string, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func (a *Assertions) PanicsWithError(errString string, f func(), msgAndArgs ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1444,7 +1444,7 @@ func (a *Assertions) PanicsWithError(errString string, f assertions.PanicTestFun // PanicsWithErrorf is the same as [Assertions.PanicsWithError], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) PanicsWithErrorf(errString string, f assertions.PanicTestFunc, msg string, args ...any) bool { +func (a *Assertions) PanicsWithErrorf(errString string, f func(), msg string, args ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1454,7 +1454,7 @@ func (a *Assertions) PanicsWithErrorf(errString string, f assertions.PanicTestFu // PanicsWithValue is the same as [PanicsWithValue], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) PanicsWithValue(expected any, f assertions.PanicTestFunc, msgAndArgs ...any) bool { +func (a *Assertions) PanicsWithValue(expected any, f func(), msgAndArgs ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } @@ -1464,7 +1464,7 @@ func (a *Assertions) PanicsWithValue(expected any, f assertions.PanicTestFunc, m // PanicsWithValuef is the same as [Assertions.PanicsWithValue], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and continues execution. -func (a *Assertions) PanicsWithValuef(expected any, f assertions.PanicTestFunc, msg string, args ...any) bool { +func (a *Assertions) PanicsWithValuef(expected any, f func(), msg string, args ...any) bool { if h, ok := a.t.(H); ok { h.Helper() } diff --git a/assert/assert_forward_test.go b/assert/assert_forward_test.go index 970d9a016..b5d5b4e95 100644 --- a/assert/assert_forward_test.go +++ b/assert/assert_forward_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert diff --git a/assert/assert_helpers.go b/assert/assert_helpers.go index c3617b6bb..331e1139f 100644 --- a/assert/assert_helpers.go +++ b/assert/assert_helpers.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert diff --git a/assert/assert_helpers_test.go b/assert/assert_helpers_test.go index b87a7b7fb..e07386f26 100644 --- a/assert/assert_helpers_test.go +++ b/assert/assert_helpers_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert diff --git a/assert/assert_types.go b/assert/assert_types.go index a73eecd47..612ae657f 100644 --- a/assert/assert_types.go +++ b/assert/assert_types.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package assert @@ -66,10 +66,6 @@ type ( // for table driven tests. PanicAssertionFunc = assertions.PanicAssertionFunc - // PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics - // methods, and represents a simple func that takes no arguments, and returns nothing. - PanicTestFunc = assertions.PanicTestFunc - // RegExp is either a text containing a regular expression to compile (string or []byte), or directly the compiled regexp. // // This is used by [RegexpT] and [NotRegexpT]. diff --git a/docs/doc-site/api/_index.md b/docs/doc-site/api/_index.md index d6fcd20c4..f4ceaa226 100644 --- a/docs/doc-site/api/_index.md +++ b/docs/doc-site/api/_index.md @@ -6,7 +6,7 @@ description: | Find the assertion function you need for your data. weight: 1 -modified: 2026-01-24 +modified: 2026-01-25 --- **The v2 our tests wanted** @@ -67,5 +67,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/boolean.md b/docs/doc-site/api/boolean.md index 4eac1bd10..01e4f8767 100644 --- a/docs/doc-site/api/boolean.md +++ b/docs/doc-site/api/boolean.md @@ -1,7 +1,7 @@ --- title: "Boolean" description: "Asserting Boolean Values" -modified: 2026-01-24 +modified: 2026-01-25 weight: 1 domains: - "boolean" @@ -235,5 +235,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/collection.md b/docs/doc-site/api/collection.md index 39cf4e77a..c1e70fb8a 100644 --- a/docs/doc-site/api/collection.md +++ b/docs/doc-site/api/collection.md @@ -1,7 +1,7 @@ --- title: "Collection" description: "Asserting Slices And Maps" -modified: 2026-01-24 +modified: 2026-01-25 weight: 2 domains: - "collection" @@ -175,7 +175,7 @@ the number of appearances of each of them in both lists should match. |--|--| | [`assertions.ElementsMatch(t T, listA any, listB any, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#ElementsMatch) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#ElementsMatch](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L522) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#ElementsMatch](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L520) {{% /tab %}} {{< /tabs >}} @@ -220,7 +220,7 @@ the number of appearances of each of them in both lists should match. |--|--| | [`assertions.ElementsMatchT(t T, listA []E, listB []E, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#ElementsMatchT) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#ElementsMatchT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L595) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#ElementsMatchT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L593) {{% /tab %}} {{< /tabs >}} @@ -230,7 +230,7 @@ Len asserts that the specified object has specific length. Len also fails if the object has a type that len() does not accept. -The asserted object can be a string, a slice, a map, an array or a channel. +The asserted object can be a string, a slice, a map, an array, pointer to array or a channel. See also [reflect.Len](https://pkg.go.dev/reflect#Len). @@ -466,7 +466,7 @@ This is an inverse of ElementsMatch. |--|--| | [`assertions.NotElementsMatch(t T, listA any, listB any, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatch) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatch](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L559) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatch](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L557) {{% /tab %}} {{< /tabs >}} @@ -514,7 +514,7 @@ This is an inverse of ElementsMatch. |--|--| | [`assertions.NotElementsMatchT(t T, listA []E, listB []E, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatchT) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatchT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L631) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotElementsMatchT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L629) {{% /tab %}} {{< /tabs >}} @@ -567,7 +567,7 @@ only the map key is evaluated. |--|--| | [`assertions.NotSubset(t T, list any, subset any, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#NotSubset) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotSubset](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L424) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotSubset](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L426) {{% /tab %}} {{< /tabs >}} @@ -782,7 +782,7 @@ SliceNotSubsetT asserts that a slice of comparable elements does not contain all |--|--| | [`assertions.SliceNotSubsetT(t T, list Slice, subset Slice, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#SliceNotSubsetT) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#SliceNotSubsetT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L495) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#SliceNotSubsetT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L493) {{% /tab %}} {{< /tabs >}} @@ -825,7 +825,7 @@ SliceSubsetT asserts that a slice of comparable elements contains all the elemen |--|--| | [`assertions.SliceSubsetT(t T, list Slice, subset Slice, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#SliceSubsetT) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#SliceSubsetT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L393) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#SliceSubsetT](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L395) {{% /tab %}} {{< /tabs >}} @@ -927,6 +927,8 @@ given in the subset (array, slice, or map). Map elements are key-value pairs unless compared with an array or slice where only the map key is evaluated. +nil values are considered as empty sets. + {{% expand title="Examples" %}} {{< tabs >}} {{% tab title="Usage" %}} @@ -969,7 +971,7 @@ only the map key is evaluated. |--|--| | [`assertions.Subset(t T, list any, subset any, msgAndArgs ...any) (ok bool)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#Subset) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#Subset](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L321) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#Subset](https://github.com/go-openapi/testify/blob/master/internal/assertions/collection.go#L325) {{% /tab %}} {{< /tabs >}} @@ -989,5 +991,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/common.md b/docs/doc-site/api/common.md index 820dc0309..5482b774a 100644 --- a/docs/doc-site/api/common.md +++ b/docs/doc-site/api/common.md @@ -1,7 +1,7 @@ --- title: "Common" description: "Other Uncategorized Helpers" -modified: 2026-01-24 +modified: 2026-01-25 weight: 18 domains: - "common" @@ -160,5 +160,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/comparison.md b/docs/doc-site/api/comparison.md index 2dfa09bf6..eaf3f6b9f 100644 --- a/docs/doc-site/api/comparison.md +++ b/docs/doc-site/api/comparison.md @@ -1,7 +1,7 @@ --- title: "Comparison" description: "Comparing Ordered Values" -modified: 2026-01-24 +modified: 2026-01-25 weight: 3 domains: - "comparison" @@ -689,5 +689,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/condition.md b/docs/doc-site/api/condition.md index 74c2dd1ca..c446a851b 100644 --- a/docs/doc-site/api/condition.md +++ b/docs/doc-site/api/condition.md @@ -1,7 +1,7 @@ --- title: "Condition" description: "Expressing Assertions Using Conditions" -modified: 2026-01-24 +modified: 2026-01-25 weight: 4 domains: - "condition" @@ -294,5 +294,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/equality.md b/docs/doc-site/api/equality.md index 912b288c1..f17f17b40 100644 --- a/docs/doc-site/api/equality.md +++ b/docs/doc-site/api/equality.md @@ -1,7 +1,7 @@ --- title: "Equality" description: "Asserting Two Things Are Equal" -modified: 2026-01-24 +modified: 2026-01-25 weight: 5 domains: - "equality" @@ -879,5 +879,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/error.md b/docs/doc-site/api/error.md index 80d2eed25..e98df1d5d 100644 --- a/docs/doc-site/api/error.md +++ b/docs/doc-site/api/error.md @@ -1,7 +1,7 @@ --- title: "Error" description: "Asserting Errors" -modified: 2026-01-24 +modified: 2026-01-25 weight: 6 domains: - "error" @@ -453,5 +453,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/file.md b/docs/doc-site/api/file.md index d141645f5..7e9f1314c 100644 --- a/docs/doc-site/api/file.md +++ b/docs/doc-site/api/file.md @@ -1,7 +1,7 @@ --- title: "File" description: "Asserting OS Files" -modified: 2026-01-24 +modified: 2026-01-25 weight: 7 domains: - "file" @@ -344,5 +344,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/http.md b/docs/doc-site/api/http.md index d6a343685..27691e14b 100644 --- a/docs/doc-site/api/http.md +++ b/docs/doc-site/api/http.md @@ -1,7 +1,7 @@ --- title: "Http" description: "Asserting HTTP Response And Body" -modified: 2026-01-24 +modified: 2026-01-25 weight: 8 domains: - "http" @@ -382,5 +382,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/json.md b/docs/doc-site/api/json.md index d54e5c06b..9613ba92e 100644 --- a/docs/doc-site/api/json.md +++ b/docs/doc-site/api/json.md @@ -1,7 +1,7 @@ --- title: "Json" description: "Asserting JSON Documents" -modified: 2026-01-24 +modified: 2026-01-25 weight: 9 domains: - "json" @@ -197,5 +197,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/number.md b/docs/doc-site/api/number.md index f931f8ecb..7d79bb7a9 100644 --- a/docs/doc-site/api/number.md +++ b/docs/doc-site/api/number.md @@ -1,7 +1,7 @@ --- title: "Number" description: "Asserting Numbers" -modified: 2026-01-24 +modified: 2026-01-25 weight: 10 domains: - "number" @@ -443,5 +443,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/ordering.md b/docs/doc-site/api/ordering.md index 00a08eb76..8bce7f859 100644 --- a/docs/doc-site/api/ordering.md +++ b/docs/doc-site/api/ordering.md @@ -1,7 +1,7 @@ --- title: "Ordering" description: "Asserting How Collections Are Ordered" -modified: 2026-01-24 +modified: 2026-01-25 weight: 11 domains: - "ordering" @@ -539,5 +539,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/panic.md b/docs/doc-site/api/panic.md index 2d7cb920a..ad33664db 100644 --- a/docs/doc-site/api/panic.md +++ b/docs/doc-site/api/panic.md @@ -1,7 +1,7 @@ --- title: "Panic" description: "Asserting A Panic Behavior" -modified: 2026-01-24 +modified: 2026-01-25 weight: 12 domains: - "panic" @@ -36,7 +36,7 @@ This domain exposes 4 functionalities. ### NotPanics{#notpanics} -NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +NotPanics asserts that the code inside the specified function does NOT panic. {{% expand title="Examples" %}} {{< tabs >}} @@ -58,32 +58,32 @@ NotPanics asserts that the code inside the specified PanicTestFunc does NOT pani {{% tab title="assert" style="secondary" %}} | Signature | Usage | |--|--| -| [`assert.NotPanics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#NotPanics) | package-level function | -| [`assert.NotPanicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#NotPanicsf) | formatted variant | -| [`assert.(*Assertions).NotPanics(f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.NotPanics) | method variant | -| [`assert.(*Assertions).NotPanicsf(f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.NotPanicsf) | method formatted variant | +| [`assert.NotPanics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#NotPanics) | package-level function | +| [`assert.NotPanicsf(t T, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#NotPanicsf) | formatted variant | +| [`assert.(*Assertions).NotPanics(f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.NotPanics) | method variant | +| [`assert.(*Assertions).NotPanicsf(f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.NotPanicsf) | method formatted variant | {{% /tab %}} {{% tab title="require" style="secondary" %}} | Signature | Usage | |--|--| -| [`require.NotPanics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#NotPanics) | package-level function | -| [`require.NotPanicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#NotPanicsf) | formatted variant | -| [`require.(*Assertions).NotPanics(f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.NotPanics) | method variant | -| [`require.(*Assertions).NotPanicsf(f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.NotPanicsf) | method formatted variant | +| [`require.NotPanics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#NotPanics) | package-level function | +| [`require.NotPanicsf(t T, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#NotPanicsf) | formatted variant | +| [`require.(*Assertions).NotPanics(f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.NotPanics) | method variant | +| [`require.(*Assertions).NotPanicsf(f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.NotPanicsf) | method formatted variant | {{% /tab %}} {{% tab title="internal" style="accent" icon="wrench" %}} | Signature | Usage | |--|--| -| [`assertions.NotPanics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#NotPanics) | internal implementation | +| [`assertions.NotPanics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#NotPanics) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotPanics](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L116) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#NotPanics](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L111) {{% /tab %}} {{< /tabs >}} ### Panics{#panics} -Panics asserts that the code inside the specified PanicTestFunc panics. +Panics asserts that the code inside the specified function panics. {{% expand title="Examples" %}} {{< tabs >}} @@ -105,34 +105,33 @@ Panics asserts that the code inside the specified PanicTestFunc panics. {{% tab title="assert" style="secondary" %}} | Signature | Usage | |--|--| -| [`assert.Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Panics) | package-level function | -| [`assert.Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Panicsf) | formatted variant | -| [`assert.(*Assertions).Panics(f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.Panics) | method variant | -| [`assert.(*Assertions).Panicsf(f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.Panicsf) | method formatted variant | +| [`assert.Panics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Panics) | package-level function | +| [`assert.Panicsf(t T, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Panicsf) | formatted variant | +| [`assert.(*Assertions).Panics(f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.Panics) | method variant | +| [`assert.(*Assertions).Panicsf(f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.Panicsf) | method formatted variant | {{% /tab %}} {{% tab title="require" style="secondary" %}} | Signature | Usage | |--|--| -| [`require.Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Panics) | package-level function | -| [`require.Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Panicsf) | formatted variant | -| [`require.(*Assertions).Panics(f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.Panics) | method variant | -| [`require.(*Assertions).Panicsf(f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.Panicsf) | method formatted variant | +| [`require.Panics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Panics) | package-level function | +| [`require.Panicsf(t T, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Panicsf) | formatted variant | +| [`require.(*Assertions).Panics(f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.Panics) | method variant | +| [`require.(*Assertions).Panicsf(f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.Panicsf) | method formatted variant | {{% /tab %}} {{% tab title="internal" style="accent" icon="wrench" %}} | Signature | Usage | |--|--| -| [`assertions.Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#Panics) | internal implementation | +| [`assertions.Panics(t T, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#Panics) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#Panics](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L29) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#Panics](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L25) {{% /tab %}} {{< /tabs >}} ### PanicsWithError{#panicswitherror} -PanicsWithError asserts that the code inside the specified PanicTestFunc -panics, and that the recovered panic value is an error that satisfies the -EqualError comparison. +PanicsWithError asserts that the code inside the specified function panics, +and that the recovered panic value is an error that satisfies the EqualError comparison. {{% expand title="Examples" %}} {{< tabs >}} @@ -154,33 +153,33 @@ EqualError comparison. {{% tab title="assert" style="secondary" %}} | Signature | Usage | |--|--| -| [`assert.PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithError) | package-level function | -| [`assert.PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithErrorf) | formatted variant | -| [`assert.(*Assertions).PanicsWithError(errString string, f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithError) | method variant | -| [`assert.(*Assertions).PanicsWithErrorf(errString string, f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithErrorf) | method formatted variant | +| [`assert.PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithError) | package-level function | +| [`assert.PanicsWithErrorf(t T, errString string, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithErrorf) | formatted variant | +| [`assert.(*Assertions).PanicsWithError(errString string, f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithError) | method variant | +| [`assert.(*Assertions).PanicsWithErrorf(errString string, f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithErrorf) | method formatted variant | {{% /tab %}} {{% tab title="require" style="secondary" %}} | Signature | Usage | |--|--| -| [`require.PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithError) | package-level function | -| [`require.PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithErrorf) | formatted variant | -| [`require.(*Assertions).PanicsWithError(errString string, f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithError) | method variant | -| [`require.(*Assertions).PanicsWithErrorf(errString string, f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithErrorf) | method formatted variant | +| [`require.PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithError) | package-level function | +| [`require.PanicsWithErrorf(t T, errString string, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithErrorf) | formatted variant | +| [`require.(*Assertions).PanicsWithError(errString string, f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithError) | method variant | +| [`require.(*Assertions).PanicsWithErrorf(errString string, f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithErrorf) | method formatted variant | {{% /tab %}} {{% tab title="internal" style="accent" icon="wrench" %}} | Signature | Usage | |--|--| -| [`assertions.PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#PanicsWithError) | internal implementation | +| [`assertions.PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#PanicsWithError) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#PanicsWithError](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L82) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#PanicsWithError](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L77) {{% /tab %}} {{< /tabs >}} ### PanicsWithValue{#panicswithvalue} -PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -the recovered panic value equals the expected panic value. +PanicsWithValue asserts that the code inside the specified function panics, +and that the recovered panic value equals the expected panic value. {{% expand title="Examples" %}} {{< tabs >}} @@ -202,26 +201,26 @@ the recovered panic value equals the expected panic value. {{% tab title="assert" style="secondary" %}} | Signature | Usage | |--|--| -| [`assert.PanicsWithValue(t T, expected any, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithValue) | package-level function | -| [`assert.PanicsWithValuef(t T, expected any, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithValuef) | formatted variant | -| [`assert.(*Assertions).PanicsWithValue(expected any, f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithValue) | method variant | -| [`assert.(*Assertions).PanicsWithValuef(expected any, f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithValuef) | method formatted variant | +| [`assert.PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithValue) | package-level function | +| [`assert.PanicsWithValuef(t T, expected any, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#PanicsWithValuef) | formatted variant | +| [`assert.(*Assertions).PanicsWithValue(expected any, f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithValue) | method variant | +| [`assert.(*Assertions).PanicsWithValuef(expected any, f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#Assertions.PanicsWithValuef) | method formatted variant | {{% /tab %}} {{% tab title="require" style="secondary" %}} | Signature | Usage | |--|--| -| [`require.PanicsWithValue(t T, expected any, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithValue) | package-level function | -| [`require.PanicsWithValuef(t T, expected any, f assertions.PanicTestFunc, msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithValuef) | formatted variant | -| [`require.(*Assertions).PanicsWithValue(expected any, f assertions.PanicTestFunc) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithValue) | method variant | -| [`require.(*Assertions).PanicsWithValuef(expected any, f assertions.PanicTestFunc, msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithValuef) | method formatted variant | +| [`require.PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithValue) | package-level function | +| [`require.PanicsWithValuef(t T, expected any, f func(), msg string, args ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#PanicsWithValuef) | formatted variant | +| [`require.(*Assertions).PanicsWithValue(expected any, f func()) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithValue) | method variant | +| [`require.(*Assertions).PanicsWithValuef(expected any, f func(), msg string, args ..any)`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#Assertions.PanicsWithValuef) | method formatted variant | {{% /tab %}} {{% tab title="internal" style="accent" icon="wrench" %}} | Signature | Usage | |--|--| -| [`assertions.PanicsWithValue(t T, expected any, f assertions.PanicTestFunc, msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#PanicsWithValue) | internal implementation | +| [`assertions.PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) bool`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#PanicsWithValue) | internal implementation | -**Source:** [github.com/go-openapi/testify/v2/internal/assertions#PanicsWithValue](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L53) +**Source:** [github.com/go-openapi/testify/v2/internal/assertions#PanicsWithValue](https://github.com/go-openapi/testify/blob/master/internal/assertions/panic.go#L49) {{% /tab %}} {{< /tabs >}} @@ -241,5 +240,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/string.md b/docs/doc-site/api/string.md index 2a071f42c..07d08a2f1 100644 --- a/docs/doc-site/api/string.md +++ b/docs/doc-site/api/string.md @@ -1,7 +1,7 @@ --- title: "String" description: "Asserting Strings" -modified: 2026-01-24 +modified: 2026-01-25 weight: 13 domains: - "string" @@ -241,5 +241,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/testing.md b/docs/doc-site/api/testing.md index d90f3d964..0320a3888 100644 --- a/docs/doc-site/api/testing.md +++ b/docs/doc-site/api/testing.md @@ -1,7 +1,7 @@ --- title: "Testing" description: "Mimicks Methods From The Testing Standard Library" -modified: 2026-01-24 +modified: 2026-01-25 weight: 14 domains: - "testing" @@ -136,5 +136,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/time.md b/docs/doc-site/api/time.md index 3b69deb38..0303eb4b5 100644 --- a/docs/doc-site/api/time.md +++ b/docs/doc-site/api/time.md @@ -1,7 +1,7 @@ --- title: "Time" description: "Asserting Times And Durations" -modified: 2026-01-24 +modified: 2026-01-25 weight: 15 domains: - "time" @@ -138,5 +138,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/type.md b/docs/doc-site/api/type.md index 69de9900c..2ed6e540a 100644 --- a/docs/doc-site/api/type.md +++ b/docs/doc-site/api/type.md @@ -1,7 +1,7 @@ --- title: "Type" description: "Asserting Types Rather Than Values" -modified: 2026-01-24 +modified: 2026-01-25 weight: 16 domains: - "type" @@ -537,5 +537,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/docs/doc-site/api/yaml.md b/docs/doc-site/api/yaml.md index 983a1ca1e..47aa0f22e 100644 --- a/docs/doc-site/api/yaml.md +++ b/docs/doc-site/api/yaml.md @@ -1,7 +1,7 @@ --- title: "Yaml" description: "Asserting Yaml Documents" -modified: 2026-01-24 +modified: 2026-01-25 weight: 17 domains: - "yaml" @@ -202,5 +202,5 @@ SPDX-License-Identifier: Apache-2.0 Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT. -Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] --> diff --git a/internal/assertions/panic.go b/internal/assertions/panic.go index 083ad46c5..6aea5cfe8 100644 --- a/internal/assertions/panic.go +++ b/internal/assertions/panic.go @@ -8,15 +8,11 @@ import ( "runtime/debug" ) -// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics -// methods, and represents a simple func that takes no arguments, and returns nothing. -type PanicTestFunc func() - // PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful // for table driven tests. -type PanicAssertionFunc func(t T, f PanicTestFunc, msgAndArgs ...any) bool +type PanicAssertionFunc func(t T, f func(), msgAndArgs ...any) bool -// Panics asserts that the code inside the specified PanicTestFunc panics. +// Panics asserts that the code inside the specified function panics. // // # Usage // @@ -26,21 +22,21 @@ type PanicAssertionFunc func(t T, f PanicTestFunc, msgAndArgs ...any) bool // // success: func() { panic("panicking") } // failure: func() { } -func Panics(t T, f PanicTestFunc, msgAndArgs ...any) bool { +func Panics(t T, f func(), msgAndArgs ...any) bool { // Domain: panic if h, ok := t.(H); ok { h.Helper() } if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func should panic\n\tPanic value:\t%#v", panicValue), msgAndArgs...) } return true } -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. +// PanicsWithValue asserts that the code inside the specified function panics, +// and that the recovered panic value equals the expected panic value. // // # Usage // @@ -50,7 +46,7 @@ func Panics(t T, f PanicTestFunc, msgAndArgs ...any) bool { // // success: "panicking", func() { panic("panicking") } // failure: "panicking", func() { } -func PanicsWithValue(t T, expected any, f PanicTestFunc, msgAndArgs ...any) bool { +func PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) bool { // Domain: panic if h, ok := t.(H); ok { h.Helper() @@ -58,18 +54,17 @@ func PanicsWithValue(t T, expected any, f PanicTestFunc, msgAndArgs ...any) bool funcDidPanic, panicValue, panickedStack := didPanic(f) if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func should panic\n\tPanic value:\t%#v", panicValue), msgAndArgs...) } if panicValue != expected { - return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...) + return Fail(t, fmt.Sprintf("func should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", expected, panicValue, panickedStack), msgAndArgs...) } return true } -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. +// PanicsWithError asserts that the code inside the specified function panics, +// and that the recovered panic value is an error that satisfies the EqualError comparison. // // # Usage // @@ -79,7 +74,7 @@ func PanicsWithValue(t T, expected any, f PanicTestFunc, msgAndArgs ...any) bool // // success: ErrTest.Error(), func() { panic(ErrTest) } // failure: ErrTest.Error(), func() { } -func PanicsWithError(t T, errString string, f PanicTestFunc, msgAndArgs ...any) bool { +func PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) bool { // Domain: panic if h, ok := t.(H); ok { h.Helper() @@ -87,11 +82,11 @@ func PanicsWithError(t T, errString string, f PanicTestFunc, msgAndArgs ...any) funcDidPanic, panicValue, panickedStack := didPanic(f) if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func should panic\n\tPanic value:\t%#v", panicValue), msgAndArgs...) } panicErr, isError := panicValue.(error) if !isError || panicErr.Error() != errString { - msg := fmt.Sprintf("func %#v should panic with error message:\t%#v\n", f, errString) + msg := fmt.Sprintf("func should panic with error message:\t%#v\n", errString) if isError { msg += fmt.Sprintf("\tError message:\t%#v\n", panicErr.Error()) } @@ -103,7 +98,7 @@ func PanicsWithError(t T, errString string, f PanicTestFunc, msgAndArgs ...any) return true } -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// NotPanics asserts that the code inside the specified function does NOT panic. // // # Usage // @@ -113,21 +108,21 @@ func PanicsWithError(t T, errString string, f PanicTestFunc, msgAndArgs ...any) // // success: func() { } // failure: func() { panic("panicking") } -func NotPanics(t T, f PanicTestFunc, msgAndArgs ...any) bool { +func NotPanics(t T, f func(), msgAndArgs ...any) bool { // Domain: panic if h, ok := t.(H); ok { h.Helper() } if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) + return Fail(t, fmt.Sprintf("func should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", panicValue, panickedStack), msgAndArgs...) } return true } // didPanic returns true if the function passed to it panics. Otherwise, it returns false. -func didPanic(f PanicTestFunc) (didPanic bool, message any, stack string) { +func didPanic(f func()) (didPanic bool, message any, stack string) { didPanic = true defer func() { diff --git a/require/assert_adhoc_example_5_test.go b/require/assert_adhoc_example_5_test.go index 1b7e70fe4..70c85f4fb 100644 --- a/require/assert_adhoc_example_5_test.go +++ b/require/assert_adhoc_example_5_test.go @@ -26,7 +26,7 @@ func ExamplePanicAssertionFunc() { type panicAssertionCase struct { name string - panicFn require.PanicTestFunc + panicFn func() requirement require.PanicAssertionFunc } diff --git a/require/require_assertions.go b/require/require_assertions.go index 9cac08894..fc6c417ba 100644 --- a/require/require_assertions.go +++ b/require/require_assertions.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require @@ -1663,7 +1663,7 @@ func Kind(t T, expectedKind reflect.Kind, object any, msgAndArgs ...any) { // // Len also fails if the object has a type that len() does not accept. // -// The asserted object can be a string, a slice, a map, an array or a channel. +// The asserted object can be a string, a slice, a map, an array, pointer to array or a channel. // // See also [reflect.Len]. // @@ -2300,7 +2300,7 @@ func NotNil(t T, object any, msgAndArgs ...any) { t.FailNow() } -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// NotPanics asserts that the code inside the specified function does NOT panic. // // # Usage // @@ -2312,7 +2312,7 @@ func NotNil(t T, object any, msgAndArgs ...any) { // failure: func() { panic("panicking") } // // Upon failure, the test [T] is marked as failed and stops execution. -func NotPanics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) { +func NotPanics(t T, f func(), msgAndArgs ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -2504,7 +2504,7 @@ func NotZero(t T, i any, msgAndArgs ...any) { t.FailNow() } -// Panics asserts that the code inside the specified PanicTestFunc panics. +// Panics asserts that the code inside the specified function panics. // // # Usage // @@ -2516,7 +2516,7 @@ func NotZero(t T, i any, msgAndArgs ...any) { // failure: func() { } // // Upon failure, the test [T] is marked as failed and stops execution. -func Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) { +func Panics(t T, f func(), msgAndArgs ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -2527,9 +2527,8 @@ func Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) { t.FailNow() } -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. +// PanicsWithError asserts that the code inside the specified function panics, +// and that the recovered panic value is an error that satisfies the EqualError comparison. // // # Usage // @@ -2541,7 +2540,7 @@ func Panics(t T, f assertions.PanicTestFunc, msgAndArgs ...any) { // failure: ErrTest.Error(), func() { } // // Upon failure, the test [T] is marked as failed and stops execution. -func PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndArgs ...any) { +func PanicsWithError(t T, errString string, f func(), msgAndArgs ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -2552,8 +2551,8 @@ func PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndAr t.FailNow() } -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. +// PanicsWithValue asserts that the code inside the specified function panics, +// and that the recovered panic value equals the expected panic value. // // # Usage // @@ -2565,7 +2564,7 @@ func PanicsWithError(t T, errString string, f assertions.PanicTestFunc, msgAndAr // failure: "panicking", func() { } // // Upon failure, the test [T] is marked as failed and stops execution. -func PanicsWithValue(t T, expected any, f assertions.PanicTestFunc, msgAndArgs ...any) { +func PanicsWithValue(t T, expected any, f func(), msgAndArgs ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -2950,6 +2949,8 @@ func StringNotContainsT[ADoc, EDoc Text](t T, str ADoc, substring EDoc, msgAndAr // Map elements are key-value pairs unless compared with an array or slice where // only the map key is evaluated. // +// nil values are considered as empty sets. +// // # Usage // // assertions.Subset(t, []int{1, 2, 3}, []int{1, 2}) diff --git a/require/require_assertions_test.go b/require/require_assertions_test.go index 396eaf75a..be406b00c 100644 --- a/require/require_assertions_test.go +++ b/require/require_assertions_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require diff --git a/require/require_examples_test.go b/require/require_examples_test.go index b812d43ba..8c9b0522e 100644 --- a/require/require_examples_test.go +++ b/require/require_examples_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require_test diff --git a/require/require_format.go b/require/require_format.go index f5e9a4584..93e641036 100644 --- a/require/require_format.go +++ b/require/require_format.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require @@ -1205,7 +1205,7 @@ func NotNilf(t T, object any, msg string, args ...any) { // NotPanicsf is the same as [NotPanics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func NotPanicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) { +func NotPanicsf(t T, f func(), msg string, args ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -1317,7 +1317,7 @@ func NotZerof(t T, i any, msg string, args ...any) { // Panicsf is the same as [Panics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) { +func Panicsf(t T, f func(), msg string, args ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -1331,7 +1331,7 @@ func Panicsf(t T, f assertions.PanicTestFunc, msg string, args ...any) { // PanicsWithErrorf is the same as [PanicsWithError], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg string, args ...any) { +func PanicsWithErrorf(t T, errString string, f func(), msg string, args ...any) { if h, ok := t.(H); ok { h.Helper() } @@ -1345,7 +1345,7 @@ func PanicsWithErrorf(t T, errString string, f assertions.PanicTestFunc, msg str // PanicsWithValuef is the same as [PanicsWithValue], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func PanicsWithValuef(t T, expected any, f assertions.PanicTestFunc, msg string, args ...any) { +func PanicsWithValuef(t T, expected any, f func(), msg string, args ...any) { if h, ok := t.(H); ok { h.Helper() } diff --git a/require/require_format_test.go b/require/require_format_test.go index fa193fbed..8aab484ef 100644 --- a/require/require_format_test.go +++ b/require/require_format_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require diff --git a/require/require_forward.go b/require/require_forward.go index 8a22cbc07..c7b46ba93 100644 --- a/require/require_forward.go +++ b/require/require_forward.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require @@ -1818,7 +1818,7 @@ func (a *Assertions) NotNilf(object any, msg string, args ...any) { // NotPanics is the same as [NotPanics], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) NotPanics(f assertions.PanicTestFunc, msgAndArgs ...any) { +func (a *Assertions) NotPanics(f func(), msgAndArgs ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -1832,7 +1832,7 @@ func (a *Assertions) NotPanics(f assertions.PanicTestFunc, msgAndArgs ...any) { // NotPanicsf is the same as [Assertions.NotPanics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) NotPanicsf(f assertions.PanicTestFunc, msg string, args ...any) { +func (a *Assertions) NotPanicsf(f func(), msg string, args ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -1958,7 +1958,7 @@ func (a *Assertions) NotZerof(i any, msg string, args ...any) { // Panics is the same as [Panics], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) Panics(f assertions.PanicTestFunc, msgAndArgs ...any) { +func (a *Assertions) Panics(f func(), msgAndArgs ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -1972,7 +1972,7 @@ func (a *Assertions) Panics(f assertions.PanicTestFunc, msgAndArgs ...any) { // Panicsf is the same as [Assertions.Panics], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) Panicsf(f assertions.PanicTestFunc, msg string, args ...any) { +func (a *Assertions) Panicsf(f func(), msg string, args ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -1986,7 +1986,7 @@ func (a *Assertions) Panicsf(f assertions.PanicTestFunc, msg string, args ...any // PanicsWithError is the same as [PanicsWithError], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) PanicsWithError(errString string, f assertions.PanicTestFunc, msgAndArgs ...any) { +func (a *Assertions) PanicsWithError(errString string, f func(), msgAndArgs ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -2000,7 +2000,7 @@ func (a *Assertions) PanicsWithError(errString string, f assertions.PanicTestFun // PanicsWithErrorf is the same as [Assertions.PanicsWithError], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) PanicsWithErrorf(errString string, f assertions.PanicTestFunc, msg string, args ...any) { +func (a *Assertions) PanicsWithErrorf(errString string, f func(), msg string, args ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -2014,7 +2014,7 @@ func (a *Assertions) PanicsWithErrorf(errString string, f assertions.PanicTestFu // PanicsWithValue is the same as [PanicsWithValue], as a method rather than a package-level function. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) PanicsWithValue(expected any, f assertions.PanicTestFunc, msgAndArgs ...any) { +func (a *Assertions) PanicsWithValue(expected any, f func(), msgAndArgs ...any) { if h, ok := a.t.(H); ok { h.Helper() } @@ -2028,7 +2028,7 @@ func (a *Assertions) PanicsWithValue(expected any, f assertions.PanicTestFunc, m // PanicsWithValuef is the same as [Assertions.PanicsWithValue], but it accepts a format msg string to format arguments like [fmt.Printf]. // // Upon failure, the test [T] is marked as failed and stops execution. -func (a *Assertions) PanicsWithValuef(expected any, f assertions.PanicTestFunc, msg string, args ...any) { +func (a *Assertions) PanicsWithValuef(expected any, f func(), msg string, args ...any) { if h, ok := a.t.(H); ok { h.Helper() } diff --git a/require/require_forward_test.go b/require/require_forward_test.go index 0c4528e6c..fe16c6974 100644 --- a/require/require_forward_test.go +++ b/require/require_forward_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require diff --git a/require/require_helpers.go b/require/require_helpers.go index cb6124ecb..d5e0332e1 100644 --- a/require/require_helpers.go +++ b/require/require_helpers.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require diff --git a/require/require_helpers_test.go b/require/require_helpers_test.go index c2e0c8375..56540d2be 100644 --- a/require/require_helpers_test.go +++ b/require/require_helpers_test.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require diff --git a/require/require_types.go b/require/require_types.go index 35895cb53..d49942ac5 100644 --- a/require/require_types.go +++ b/require/require_types.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated with github.com/go-openapi/testify/codegen/v2; DO NOT EDIT. -// Generated on 2026-01-24 (version 178304f) using codegen version v2.1.9-0.20260123222731-178304f36678+dirty [sha: 178304f366789315d4db6b11c89786c43d916247] +// Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a] package require @@ -64,11 +64,7 @@ type ( // PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful // for table driven tests. - PanicAssertionFunc func(t T, f assertions.PanicTestFunc, msgAndArgs ...any) - - // PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics - // methods, and represents a simple func that takes no arguments, and returns nothing. - PanicTestFunc = assertions.PanicTestFunc + PanicAssertionFunc func(t T, f func(), msgAndArgs ...any) // RegExp is either a text containing a regular expression to compile (string or []byte), or directly the compiled regexp. //