testify/assert
Olivier Mengué d3dbb19355 assert: make YAML dependency pluggable via build tags
Make the YAML dependency required for {assert,require}.YAMLEq{,f} pluggable.

The implementation can be selected using build tags:
- testify_yaml_default (default): gopkg.in/yaml.v3 is used, like before
- testify_yaml_fail: YAML deserialization is not implemented and always
  fails. So assert.YAMLEq always fails. This is useful if the test suite
  package doesn't use assert.YAMLEq (very common case).
- testify_yaml_custom: the github.com/stretchr/testify/assert/yaml
  package exposes an Unmarshal variable of type func([]byte, any) error
  (same as gopkg.in/yaml.v3) that allows to plug any alternate
  implementation. For example github.com/goccy/go-yaml.Unmarshal.
  This allows to avoid the link constraints of the license of
  gopkg.in/yaml.v3 (see PR stretchr/testify#1120).

Usage: go test -tags testify_yaml_fail

To install the alternate implementation with testify_yaml_custom:

	//go:build testify_yaml_custom

	package my_pkg_test

	import (
		goyaml "github.com/goccy/go-yaml"
		"github.com/stretchr/testify/assert/yaml"
	)

	func init() {
		yaml.Unmarshal = goyaml.Unmarshal
	}
2024-03-31 22:37:21 +02:00
..
internal/unsafetests assert: more unsafe.Pointer tests 2023-11-09 16:32:25 +01:00
yaml assert: make YAML dependency pluggable via build tags 2024-03-31 22:37:21 +02:00
assertion_compare.go assert: restore CompareType, but mark it as deprecated 2024-03-20 00:47:39 +01:00
assertion_compare_test.go assert: drop CompareType 2024-03-20 00:47:39 +01:00
assertion_format.go Merge pull request #1385 from hslatman/not-implements 2024-02-28 16:02:08 +00:00
assertion_format.go.tmpl Fix vim-go integration and other editors 2018-02-02 18:39:40 +00:00
assertion_forward.go Merge pull request #1385 from hslatman/not-implements 2024-02-28 16:02:08 +00:00
assertion_forward.go.tmpl Fix vim-go integration and other editors 2018-02-02 18:39:40 +00:00
assertion_order.go assert: drop CompareType 2024-03-20 00:47:39 +01:00
assertion_order_test.go add tests for correct msgAndArgs forwarding 2022-02-10 20:09:05 +10:00
assertions.go assert: make YAML dependency pluggable via build tags 2024-03-31 22:37:21 +02:00
assertions_test.go Add PanicAssertionFunc (#1337, #730) 2024-03-05 10:13:30 +01:00
doc.go EqualExportedValues: Handle nested pointer, slice and map fields (#1379) 2023-05-11 07:42:04 +10:00
errors.go Clean up golint warnings 2014-06-18 09:28:16 -06:00
forward_assertions.go Make _codegen its own module so that its dependencies do not pollute the root modules dependency graph 2019-12-09 10:12:49 -07:00
forward_assertions_test.go Add ErrorContains 2021-01-16 12:32:05 +11:00
http_assertions.go http_assertions: honour the msgAndArgs provided with each assertion 2024-02-23 00:16:29 +05:30
http_assertions_test.go http_assertions: assert that the msgAndArgs actually works in tests 2024-02-23 22:41:24 +05:30