Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ With 76 assertion functions, this generates 608 functions automatically.
### Dependency Isolation Strategy
- **internal/spew**: Internalized copy of go-spew for pretty-printing values
- **internal/difflib**: Internalized copy of go-difflib for generating diffs
- **assert/yaml**: Stub package that panics by default if YAML assertions are used
- **internal/assertions/enable**: Internal stubs that panic by default if YAML/color assertions are used
- **enable/stubs**: Public API for enabling optional features (yaml, colors)
- **enable/yaml**: Optional module that activates YAML support via init() when imported
- **enable/colors**: Optional module that activates colorized output via init() when imported

The "enable" pattern allows YAML functionality to be opt-in: import `_ "github.com/go-openapi/testify/v2/enable/yaml"` to activate YAML assertions without forcing a dependency on all users.
The "enable" pattern allows optional functionality to be opt-in: import `_ "github.com/go-openapi/testify/v2/enable/yaml"` to activate YAML assertions, or `_ "github.com/go-openapi/testify/v2/enable/colors"` to enable colorized output, without forcing dependencies on all users.

## Development Commands

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
permissions:
contents: write
pull-requests: write
uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/bump-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
permissions:
contents: write
pull-requests: write
uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
with:
bump-type: ${{ inputs.bump-type }}
tag-message-title: ${{ inputs.tag-message-title }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
permissions:
contents: read
security-events: write
uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
permissions:
pull-requests: write
contents: write
uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
secrets: inherit
4 changes: 3 additions & 1 deletion .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ on:

jobs:
test:
uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
with:
extra-flags: '-tags testcgo' # this is to trigger extra tests in spew
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
permissions:
contents: read
security-events: write
uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # V0.2.4
uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # V0.2.4
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Create release
permissions:
contents: write
uses: go-openapi/ci-workflows/.github/workflows/release.yml@50a35d7a3dec2ab631ddc39b1307a8394fcc44c7 # v0.2.4
uses: go-openapi/ci-workflows/.github/workflows/release.yml@ea0dfc9a8f78335f47355d842b76bcf95d29c846 # v0.2.5
with:
tag: ${{ github.ref_name }}
is-monorepo: true
Expand Down
2 changes: 1 addition & 1 deletion assert/assert_assertions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_assertions_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_examples_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_format.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_format_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_forward.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_forward_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_helpers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assert_helpers_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions assert/assert_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions assert/doc.go
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
// SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0

// Package assert provides a set of testing tools for use with the standard Go testing system.
//
// # Note
//
// All functions in this package return a bool value indicating whether the assertion has passed.
//
// # Example usage
//
// The following is a complete example using assert in a standard test function:
//
// import (
// "testing"
// "github.com/go-openapi/testify/v2/assert"
// )
//
// func TestSomething(t *testing.T) {
//
// var a string = "Hello"
// var b string = "Hello"
//
// assert.Equal(t, a, b, "The two words should be the same.")
//
// }
//
// if you assert many times, use the format below:
//
// import (
// "testing"
// "github.com/go-openapi/testify/v2/assert"
// )
//
// func TestSomething(t *testing.T) {
// assert := assert.New(t)
//
// var a string = "Hello"
// var b string = "Hello"
//
// assert.Equal(a, b, "The two words should be the same.")
// }
//
// # Assertions
//
// Assertions allow you to easily write test code.
//
// All assertion functions take as the first argument, the [*testing.T] object provided by the
// standard testing framework.
//
// This allows the assertion functions to write the failings and other details to the correct place.
//
// Every assertion function also takes an optional string message as the final argument,
// allowing custom error messages to be appended to the message the assertion method outputs.
//
// See [our doc site](https://go-openapi.github.io/testify/) for usage and examples and
// [go docs](https://pkg.go/dev/go-openapi/testify) for complete reference.
package assert
3 changes: 3 additions & 0 deletions codegen/internal/generator/render.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0

package generator

import (
Expand Down
3 changes: 3 additions & 0 deletions codegen/internal/model/documentation.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0

package model

import (
Expand Down
3 changes: 3 additions & 0 deletions codegen/internal/scanner/module_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0

package scanner

import "testing"
Expand Down
6 changes: 3 additions & 3 deletions docs/doc-site/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: |

Find the assertion function you need for your data.
weight: 1
modified: 2026-01-25
modified: 2026-01-26
---

**The v2 our tests wanted**
Expand Down Expand Up @@ -49,7 +49,7 @@ Each domain contains assertions regrouped by their use case (e.g. http, json, er
- [Time](./time.md) - Asserting Times And Durations (2)
- [Type](./type.md) - Asserting Types Rather Than Values (10)
- [Yaml](./yaml.md) - Asserting Yaml Documents (3)
- [Common](./common.md) - Other Uncategorized Helpers (4)
- [Common](./common.md) - Other Uncategorized Helpers (3)

---

Expand All @@ -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-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a]
Generated on 2026-01-26 (version cbd4c16) using codegen version v2.2.1-0.20260126160846-43574c83eea9+dirty [sha: 43574c83eea9c46dc5bb573128a4038e90e2f44b]
-->
4 changes: 2 additions & 2 deletions docs/doc-site/api/boolean.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Boolean"
description: "Asserting Boolean Values"
modified: 2026-01-25
modified: 2026-01-26
weight: 1
domains:
- "boolean"
Expand Down Expand Up @@ -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-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a]
Generated on 2026-01-26 (version cbd4c16) using codegen version v2.2.1-0.20260126160846-43574c83eea9+dirty [sha: 43574c83eea9c46dc5bb573128a4038e90e2f44b]
-->
4 changes: 2 additions & 2 deletions docs/doc-site/api/collection.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Collection"
description: "Asserting Slices And Maps"
modified: 2026-01-25
modified: 2026-01-26
weight: 2
domains:
- "collection"
Expand Down Expand Up @@ -991,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-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a]
Generated on 2026-01-26 (version cbd4c16) using codegen version v2.2.1-0.20260126160846-43574c83eea9+dirty [sha: 43574c83eea9c46dc5bb573128a4038e90e2f44b]
-->
34 changes: 3 additions & 31 deletions docs/doc-site/api/common.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
title: "Common"
description: "Other Uncategorized Helpers"
modified: 2026-01-25
modified: 2026-01-26
weight: 18
domains:
- "common"
keywords:
- "CallerInfo"
- "CallerInfof"
- "New"
- "Newf"
- "ObjectsAreEqual"
- "ObjectsAreEqualf"
- "ObjectsAreEqualValues"
Expand All @@ -25,7 +23,7 @@ Other Uncategorized Helpers

_All links point to <https://pkg.go.dev/github.com/go-openapi/testify/v2>_

This domain exposes 4 functionalities.
This domain exposes 3 functionalities.

```tree
```
Expand Down Expand Up @@ -65,32 +63,6 @@ failed.
{{% /tab %}}
{{< /tabs >}}

### New

New makes a new [Assertions] object for the specified [T].


{{< tabs >}}
{{% tab title="assert" style="secondary" %}}
| Signature | Usage |
|--|--|
| [`assert.New(t T) *Assertions`](https://pkg.go.dev/github.com/go-openapi/testify/v2/assert#New) | package-level function |
{{% /tab %}}
{{% tab title="require" style="secondary" %}}
| Signature | Usage |
|--|--|
| [`require.New(t T) *Assertions`](https://pkg.go.dev/github.com/go-openapi/testify/v2/require#New) | package-level function |
{{% /tab %}}

{{% tab title="internal" style="accent" icon="wrench" %}}
| Signature | Usage |
|--|--|
| [`assertions.New(t T) *Assertions`](https://pkg.go.dev/github.com/go-openapi/testify/v2/internal/assertions#New) | internal implementation |

**Source:** [github.com/go-openapi/testify/v2/internal/assertions#New](https://github.com/go-openapi/testify/blob/master/internal/assertions/assertion.go#L12)
{{% /tab %}}
{{< /tabs >}}

### ObjectsAreEqual

ObjectsAreEqual determines if two objects are considered equal.
Expand Down Expand Up @@ -160,5 +132,5 @@ SPDX-License-Identifier: Apache-2.0

Document generated by github.com/go-openapi/testify/codegen/v2 DO NOT EDIT.

Generated on 2026-01-25 (version f9aee45) using codegen version v2.1.9-0.20260125223317-f9aee45df796+dirty [sha: f9aee45df7969f1ad686953c5695ffe353eaa13a]
Generated on 2026-01-26 (version cbd4c16) using codegen version v2.2.1-0.20260126160846-43574c83eea9+dirty [sha: 43574c83eea9c46dc5bb573128a4038e90e2f44b]
-->
Loading
Loading